npm.io
1.0.2 • Published 9 years ago

contenthash-html-webpack-plugin

Licence
MIT
Version
1.0.2
Deps
1
Vulns
0
Weekly
0
Stars
2

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

Keywords