create-hash-file-webpack

Webpack plugin for creating the file with the hash in it

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
create-hash-file-webpack
111.0.45 years ago5 years agoMinified + gzip package size for create-hash-file-webpack in KB

Readme

Create hash file plugin for WebPack
License: MIT
A webpack plugin to create a file with the hash.
\hash will be replaced by the compilation hash
Inspired by create-file-webpackhttps://github.com/Appius/create-file-webpack

Installation

npm i create-hash-file-webpack --save-dev

Usage

const CreateHashFileWebpack = require('create-hash-file-webpack')

// webpack config
{
  plugins: [
    new CreateHashFileWebpack([
    {
        // path to folder in which the file will be created
        path: './dist',
        // file name
        fileName: 'index.js',
        // content of the file
        content: 'the compilation hash is [hash]'
    },
    {
        // path to folder in which the file will be created
        path: './dist',
        // file name
        fileName: 'scripts.html',
        // content of the file
        content: '<script src="/js/bundle.[hash].js"></script>'
    }])
  ]
}