Bundle and transform javascript files, stylesheets, html imports and update DOM document
MIT License
New in version 3: uses rollup for bundling, and still supports old-style bundling. New in version 4: resolve native relative imports, better async/await support.
npm install -g bundledom
This saves modified html file, and styles are bundled into js file:
bundledom
--html bundles/index.html
--js /bundles/index.js
-x jquery.js -x moment.js -i index.js
--prepend '/js/custom-elements.js'
public/index.html
This saves styles separately:
bundledom
--html bundles/index.html
--css /bundles/index.css
--js /bundles/index.js
--exclude jquery.js
--prepend '/js/custom-elements.js'
public/index.html
This does not compress files, and specifies root dir
bundledom
--concatenate
--html bundles/index.html
--css /bundles/index.css
--js /bundles/index.js
--exclude jquery.js
--prepend '/js/custom-elements.js'
--root public
public/templates/index.html
A tool to bundle a bunch of files:
bundledom-all
--filter "**/excluded-*.*"
--common common.html
--suffix 1.0.0
"templates/*.html"
it bundles common files then processes all files matching pattern and put everything with suffixes in a bundles/ directory.
See bundledom-all -h
for more command-line options.
Paths are relative to the input file path.
bundledom(path, opts, cb)
where path
is the path of the html file to process,
and opts
has these properties:
Strings are matched simply by searching a substring.
Tags without src or href attributes can be excluded or ignored by passing a dot ".", otherwise they are bundled.
Omitting js, css options skips the insertion of the corresponding tag in the html document.
If cb is omitted, returns a promise.
Returns an object with following properties:
bundledom --help
MIT, see LICENSE file.