Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
hash-content-html-webpack-plugin
Advanced tools
Generate md5 hash for html file (e.g. `index.f8704d178ff376c380a6.html`), based on file's content and working with [html-webpack-plugin](https://github.com/jantimon/html-webpack-plugin).
Generate md5 hash for html file (e.g. index.f8704d178ff376c380a6.html
),
based on file's content and working with html-webpack-plugin.
index.html
<!doctype html>
<head><link href="/app/css/index.8a09fef2bfaf1c05ca22.css" rel="stylesheet"></head>
<body>
<script type="text/javascript" src="/app/js/vendor.d5474870259fc6bd8afb.js"></script>
<script type="text/javascript" src="/app/js/index.40555284b534ede23047.js"></script>
</body></html>
webpack.config.js
const HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = {
...
plugins: [
...
new HtmlWebpackPlugin({
filename: 'index.[hash].html'
}),
]
}
// output: index.c5474870259fc6bd8afd.html
Once css
and js
are modified, their hash will change(e.g. /app/css/index.8a09fef2bfaf1c05ca22.css
changes to /app/css/index.375969b84db8a0c16a1d.css
), so html's content will change,but html's hash will not change by using [hash]
[chunkhash]
, the output is still index.c5474870259fc6bd8afd.html
。So if you want to change html's hash when html's content changes, you should use [contenthash]
provided by hash-content-html-webpack-plugin
.
npm install hash-content-html-webpack-plugin --save-dev
webpack.config.js
const HtmlWebpackPlugin = require('html-webpack-plugin')
const HashContentHtmlWebpackPlugin = require('hash-content-html-webpack-plugin')
module.exports = {
...
plugins: [
...
new HtmlWebpackPlugin({
filename: 'index.[contenthash].html'
}),
new HashContentHtmlWebpackPlugin()
]
}
// output: index.f8704d178ff376c380a6.html
MIT
FAQs
Generate md5 hash for html file (e.g. `index.f8704d178ff376c380a6.html`), based on file's content and working with [html-webpack-plugin](https://github.com/jantimon/html-webpack-plugin).
The npm package hash-content-html-webpack-plugin receives a total of 7 weekly downloads. As such, hash-content-html-webpack-plugin popularity was classified as not popular.
We found that hash-content-html-webpack-plugin demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.