{"_id":"html-webpack-alter-asset-plugin","_rev":"2248843","name":"html-webpack-alter-asset-plugin","description":"Allow plugins to make changes to the assets before invoking the template when using html-webpack-plugin","dist-tags":{"latest":"1.0.0"},"maintainers":[{"name":"mwumli","email":"mwumli@hotmail.com"}],"time":{"modified":"2017-03-29T21:07:36.000Z","created":"2016-09-15T11:18:44.930Z","1.0.0":"2016-09-15T11:18:44.930Z"},"users":{},"author":{"name":"MwumLi"},"repository":{"type":"git","url":"git+https://github.com/MwumLi/html-webpack-alter-asset-plugin.git"},"versions":{"1.0.0":{"name":"html-webpack-alter-asset-plugin","version":"1.0.0","description":"Allow plugins to make changes to the assets before invoking the template when using html-webpack-plugin","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/MwumLi/html-webpack-alter-asset-plugin.git"},"keywords":["webpack","plugin","html","html-webpack-plugin","alter","asset"],"author":{"name":"MwumLi"},"license":"MIT","bugs":{"url":"https://github.com/MwumLi/html-webpack-alter-asset-plugin/issues"},"homepage":"https://github.com/MwumLi/html-webpack-alter-asset-plugin#readme","devDependencies":{"html-webpack-plugin":"^2.16.0","jasmine":"^2.5.1","webpack":"^1.13.0"},"gitHead":"4e7cd47a83e97e2b8bf8648f829eb2ec919ebfd0","_id":"html-webpack-alter-asset-plugin@1.0.0","_shasum":"1ffbce662ad2ab9b4bb08a575435ecb57697d9ef","_from":".","_npmVersion":"3.8.3","_nodeVersion":"5.10.1","_npmUser":{"name":"mwumli","email":"mwumli@hotmail.com"},"dist":{"shasum":"1ffbce662ad2ab9b4bb08a575435ecb57697d9ef","size":3369,"noattachment":false,"tarball":"https://registry.npm.taobao.org/html-webpack-alter-asset-plugin/download/html-webpack-alter-asset-plugin-1.0.0.tgz"},"maintainers":[{"name":"mwumli","email":"mwumli@hotmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/html-webpack-alter-asset-plugin-1.0.0.tgz_1473938324600_0.18233127938583493"},"directories":{},"publish_time":1473938324930,"_cnpm_publish_time":1473938324930,"_hasShrinkwrap":false}},"readme":"# html-webpack-alter-asset-plugin\nAllow plugins to make changes to the assets before invoking the template when using [html-webpack-plugin](html-webpack-plugin)\n\n\n## Introduce \n\nIn some case, we want to make some changes to static resources(js and css) before inserting it into the output file, such as: \n* spectify the order of js and css, it cann't meet our expectations to use the option `chunksSortMode` from [html-webpack-plugin][html-webpack-plugin] \n* Insert additional static resources, which not introduced in the webpack \n... \n\nBased on the above requirements, I finished it! \n\n\n## Installation \n\nYou must be running webpack on node 4.3 or higher \n\nInstall the plugin with npm: \n\n $ npm install --save-dev html-webpack-alter-asset-plugin\n\n## Basic Usage \n\nwebpack.config.js : \n\n \"use strict\";\n let HtmlWebpackPlugin = require('html-webpack-plugin');\n let htmlWebpackAlterAssetPlugin = require('html-webpack-alter-asset-plugin');\n\n ...\n\n module.exports = {\n entry: {\n \"vendor\": path.resolve(BASE_PATH, 'vendor.browser.js'),\n \"polyfills\": path.resolve(BASE_PATH, 'polyfills.browser.js'),\n \"app\": path.resolve(BASE_PATH, 'app.js'),\n \"style\": path.resolve(BASE_PATH, 'style.js'),\n \"vnc\": path.resolve(BASE_PATH, 'vnc.js'),\n \"register\": path.resolve(BASE_PATH, 'register.js'),\n },\n ...\n plugins: {\n new HtmlWebpackPlugin({\n template: './src/app/app.html',\n filename: 'tpl/index.html',\n injectAlter: {\n js: { \n keys: [ '~/system.json', 'commons', 'vendor', 'style', 'polyfills', 'app' ] \n }\n }\n }),\n new htmlWebpackAlterAssetPlugin()\n }\n ...\n }\n\nAfter run webpack, `\n\n \n\n\nchanges : \n\n1. `~/system.json` into `/system.json`, so `