Add file version after the assets` src for the HTML Webpack Plugin
This plugin allows you to add a version string for each static asset in the output from html-webpack-plugin.
Installation
You must be running webpack on node 4.x or higher
Install the plugin with npm:
$ npm install --save-dev static-version-injection-html-webpack-plugin
Basic Usage
Require the plugin in your webpack config:
var StaticVersionInjectionPlugin = ;
Add the plugin to your webpack config as follows:
plugins: md5: true
Options
The available options are:
-
md5
:boolean
Specifying whether to use md5 version for all static assets or not.
Example
Using HtmlWebpackIncludeAssetsPlugin
and CopyWebpackPlugin
to include assets to html-webpack-plugin
template :
// ...output: filename: utils // or // filename: utils.assetsPath('js/[name].js') // ...plugins: // extract css into its own file filename: utils // or // filename: utils.assetsPath('css/[name].[contenthash].css')
User md5 mode :
plugins: md5: true
Then you will get html like this
test1