A plugin to help webpack concat js and inject into html
Webpack is really powerful. However, when I want to change the asset files and inject into html without webpack JSONP code wrapper, it seems impossible to do that without other tool's help.
npm install html-webpack-replace-assets-plugin --save-dev
- replace assets path when inject to html(with html-webpack-plugin)
const HtmlWebpackReplaceAssetsPlugin = require('html-webpack-replace-assets-plugin');
new HtmlWebpackReplaceAssetsPlugin({
...see options
// examples
convert(asset, path) {
// asset: webpack asset object
// path: asset path
return path.replace('.js', `${asset.size()}.js.gz`);
}
});
assets path(or name) transformer
- [ ] add css support