1.0.2 • Published 7 years ago

contenthash-html-webpack-plugin v1.0.2

Weekly downloads
6
License
MIT
Repository
github
Last release
7 years ago

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