npm install workers-factory --save
const Factory = ;//// Run a webpack build//Factory;
options.content is a path to a fully built (
Worker will trigger the factory to go through the following methods in series. The factory line will always have to complete in full for a build to be considered done.
||Untar the contents of the tarball|
||Check if entry file exists|
||Read the entry file|
||Execute the builder implemented
||Minify the content for
||Create a tarball of contents|
||Remove temporary build directory|
Factory.assemble will execute the exported
run function from each worker.
It will callback the next step in the chain with a
Buffer of content if
it completes without errors.
- Browserify: Create a bundle using Browserify. Configured
package.json#browserifythe content is passed to the
- Webpack: Will read
webpack.config.jsfrom tarball content and execute the bundled Webpack to generate a build of assets.
Based on the file extension one of the following minifiers is available to
minify the asset content. Configuration for both JS minifiers can be supplied
wrhs.toml using the
- CleanCSS: Minifies CSS using CleanCSS, special comments are removed and a sourcemap is generated by default.
- Minimize: Minifies HTML using minimize.
- Uglifyjs: Minify JS using Uglifyjs.
- Terser: Minify JS (containing ES6) using Terser. Requires opt-in in
wrhs.toml][wrhs.toml][minify]minifier = 'terser'