trucks-transform-bundle
v1.0.3
Published
Bundle files into the output templates, styles and scripts
Downloads
7
Readme
Bundle Transform
Bundle files into the output templates, styles and scripts
Install
npm i trucks-transform-bundle --save-dev
For the command line interface see trucks-cli.
Usage
Use the bundle
key to configure this transform:
const trucks = require('trucks');
trucks(
{
files: ['components.html'],
transforms: ['bundle'],
conf: {
transforms: {
bundle: {
css: ['styles.css'],
js: ['app.js']
}
}
}
}, (err, res) => {
if(err) {
throw err;
}
console.log(res);
}
);
API
bundle
public bundle(state, conf)
Add input files to the output templates, styles and scripts.
The default behaviour will prepend input files.
Use the css
, html
and js
lists to prepend files to the
corresponding output file. You may also use a more explicit notation
with the before
and after
options to control whether bundled
files are appended or prepended.
Returns map of visitor functions.
state
Object compiler state.conf
Object transform plugin configuration.
Options
before
Object map of files to prepend.after
Object map of files to append.css
Array files to bundle with the stylesheet.html
Array files to bundle with the templates.js
Array files to bundle with the javascript.
License
MIT
Created by mkdoc on July 28, 2016