UNPKG

makestatic-pack-webpack

Version:

Bundle assets using webpack

140 lines (95 loc) 3.39 kB
# Webpack > Webpack asset bundling Bundles assets using [webpack][]. --- - [Install](#install) - [API](#api) - [PackWebpack](#packwebpack) - [.before](#before) - [Config](#config) - [Config](#config-1) - [.getConfig](#getconfig) - [PackPlugin](#packplugin) - [.addFiles](#addfiles) - [.apply](#apply) - [License](#license) --- ## Install ``` yarn add makestatic-pack-webpack ``` ## API ### PackWebpack Bundles source file assets using webpack. #### .before ```javascript PackWebpack.prototype.before(context[, options]) ``` Configures the webpack compiler with system plugins. If the configuration option `pack` is disabled this function call is a noop. If the `watch` configuration option is set the compiler watches source files and the returned promise will never resolve. In this instance the webpack plugin is responsible for executing the rest of the lifecycle at the appropriate time. Returns a promise that resolves when compilation is complete. * `context` Object the processing context. * `options` Object plugin options. ### Config Converts the build configuration into a webpack compatible configuration removing fields that are not used by webpack. #### Config ```javascript new Config(context) ``` Creates a Config. * `context` Object the processing context. #### .getConfig ```javascript Config.prototype.getConfig(system, options) ``` Get a webpack compatible configuration. * `system` Object plugins required by the system. * `options` Object plugin options. ### PackPlugin System webpack plugin. #### .addFiles ```javascript PackPlugin.prototype.addFiles(compilation, files) ``` Adds compilation entries. Returns a promise that resolves when all the files have been added. * `compilation` Object the webpack compilation. * `files` Array list of files to add to the compilation. #### .apply ```javascript PackPlugin.prototype.apply(compiler) ``` Webpack plugin entry point that configures the webpack plugin functions. * `compiler` Object the webpack compiler. ## License MIT --- Created by [mkdoc](https://github.com/mkdoc/mkdoc) on March 12, 2017 [docs]: https://makestatic.ws/docs/ "Documentation" [standalone manual]: https://github.com/makestatic/website/blob/master/MANUAL.md "Standalone Manual" [yarn]: https://yarnpkg.com "Yarn" [webpack]: https://webpack.js.org "Webpack" [babel]: https://babeljs.io "Babel" [postcss]: http://postcss.org "Postcss" [sugarss]: https://github.com/postcss/sugarss "Sugarss" [reshape]: https://github.com/reshape/reshape "Reshape Source Code" [reshapeml]: https://reshape.ml "Reshape" [clean-css]: https://github.com/jakubpawlowicz/clean-css "Clean CSS" [html-minifier]: https://github.com/kangax/html-minifier "Html Minifier" [uglify-js]: https://github.com/mishoo/UglifyJS2 "Uglify JS" [imagemin]: https://github.com/imagemin/imagemin "Imagemin" [mkdoc]: https://github.com/mkdoc/mkdoc "Mkdoc" [browsersync]: https://www.browsersync.io "Browsersync" [yeoman]: http://yeoman.io "Yeoman" [spike]: https://www.spike.cf "Spike" [validator]: https://github.com/validator/validator "HTML Validator" [github pages]: https://pages.github.com "Github Pages" [amazon s3]: https://aws.amazon.com/s3/ "Amazon S3" [google sitemaps]: https://support.google.com/webmasters/answer/183668?hl=en&ref_topic=4581190 "Google Sitemaps" [sitemaps]: https://www.sitemaps.org/ "Sitemaps"