contenthash-html-webpack-plugin

1.0.2 • Public • Published

Build Status Coverage

contenthash-html-webpack-plugin

Makes [contenthash] available for html-webpack-plugin

Install

$ npm install contenthash-html-webpack-plugin --save-dev

Usage

import ContentHashHtmlPlugin from 'contenthash-html-webpack-plugin'
import HtmlPlugin from 'html-webpack-plugin'
 
const webpackConfig = {
  ...,
  plugins: [
    new HtmlPlugin({
      filename: `[file]-[contenthash:16].html`,
      ...
    }),
    new ContentHashHtmlPlugin()
  ]
}
 
// Then the file hash will be the hash of the file content

Available Placeholder Format

'[contenthash]'
'[contenthash:7]'           // maxLength: 7
'[md5:contenthash:hex]'     // hashType: md5, digestType: hex
 
'[md5:contenthash:hex:7]'
// hashType: md5
// digestType: hex
// maxLength: 7

License

MIT

Package Sidebar

Install

npm i contenthash-html-webpack-plugin

Weekly Downloads

66

Version

1.0.2

License

MIT

Last publish

Collaborators

  • kael