options
(in addition to builder options):
sourceMap
- enable source maps. Disabled by default. Not really working yet!sourceURL
- enable source URLs. Defaults todevelopment
.alias
- alias components with their shortnames. Allows you torequire()
components outside the build without worrying about versions. Defaults todevelopment
.
Note that the require()
implementation is not included in the build.
You can access it at build.scripts.require
, or as the npm
module component-require2
.
For example:
build.scripts(node, options)
.use()
.end(function (err, string) {
fs.writeFile('build.build.js', build.scripts.require + string);
})
The require()
implementation used by Component. You must include this in your built JS yourself.
Return the JS entry point of a tree, allowing you to require(canonical)
in the build.
UMD-wrap JS with the given canonical
name derived from build.scripts.canonical()
, a global alias
name, and the js
without the require
implementation.
The script builder's file
objects have the following additional properties:
resolvePath
-.path
relative to the component's.main
.name
- the name of this file will be registered as in therequire
build.
Note: file.string
must be populated for a file to be included in the build.
Includes a file as regular Javascript. Checks syntax errors as well.
build.scripts()
.use('scripts', builder.plugins.js());
Includes a file as JSON. Will throw on invalid JSON.
build.scripts()
.use('json', builder.plugins.json());
Includes a file as a string.
build.scripts()
.use('templates', builder.plugins.string());
- html-minifier - minifies your HTML templates
- builder-es6-module-to-cjs - es6 module to cjs compiler
- jade
- regenerator - compiles generators to ES5
- coffee