Plugin for webpack replaces contenthash
npm install replacer-contenthash-webpack-pluginReplacer Contenthash Webpack Plugin
================================
This plugin is designed to add for your static files such as css, js, images, svg-sprite contenthash.
Its main purpose is processing links to your file and generating contenthash.
Tip: For work you need to install the plugin "loader-utils".
shell
$ npm install replacer-contenthash-webpack-plugin
`Example
$3
`javascript
const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const ReplacerContenthashWebpackPlugin = require('replacer-contenthash-webpack-plugin');module.exports = {
entry: {
vendor: ['./src/vendor.js']
},
output: {
path: path.join(__dirname, 'dist/build'),
filename: '[name].js',
publicPath: '/static/',
},
module: {
rules: [
{
test: /\.css$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: 'css-loader'
})
}
]
},
plugins: [
new ExtractTextPlugin('[name].css'),
new ReplacerContenthashWebpackPlugin({
// Path to the folder with the files that will be replaced
filesDir : ["src"],
// List of files to be replaced
files : ["src/vendor.js, src/vendor.css", "src/vendor.rtl.css", "src/images.png", "src/svg-sprite.svg"],
// Path to a specific template
templates : ["templates/index.html"],
// Folder in which will search for templates
templatesFolder : ["templates"]
}),
// OR
new ReplacerContenthashWebpackPlugin({
files : ["src/vendor.js, src/vendor.css", "src/vendor.rtl.css", "src/images.png", "src/svg-sprite.svg"],
templates : ["templates/index.html"],
}),
// OR
new ReplacerContenthashWebpackPlugin({
filesDir : ["src"],
templatesFolder : ["templates"]
}),
]
};
`
$3
`html

`
$3
`html

``