
Security News
New React Server Components Vulnerabilities: DoS and Source Code Exposure
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.
Add rev to filename based on file content hashsum.
This plugin requires Grunt ~0.4.1
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install hash-data --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('hash-data');
This task will revision your files based on its contents. You should then set the file and hash options.
grunt.initConfig({
hash_data: {
files_list: {
src: ['Project/index.html', 'Project/js/script.js']
dest: 'Project/build'
},
options: {
affix: 'prefix',
separator: '-',
length: 6,
algorithm: 'sha1',
summary: 'summary.json',
after: function(summary, options) {
// Callback
}
}
}
})
Type: String
Default value: 'md5'
algorithm is dependent on the available algorithms supported by the version of OpenSSL on the platform. Examples are 'sha1', 'md5', 'sha256', 'sha512', etc. On recent releases, openssl list-message-digest-algorithms will display the available digest algorithms.
Type: Number
Default value: '8'
The number of characters of the file content hash to affix the file name with.
Type: String
Default value: 'utf8'
The encoding of the file contents.
Type: String
Default value: '.'
A string value that is used to do something with whatever.
Type: String
Default value: 'prefix'
A string value that is used to do something else with whatever else.
Type: String
Default value: 'prefix'
Summary file path. The content look like that:
{
"index.html": {
"hash": "b275f5",
"absPath": "/home/user/Project/b275f5.index.html",
"relPath": "b275f5.index.html"
},
"js/script.js": {
"hash": "cad805",
"absPath": "/home/user/Project/js/cad805.script.js",
"relPath": "js/cad805.script.js"
}
}
FAQs
Add rev to filename based on file content hashsum. Produce summary file.
We found that hash-data 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
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.

Security News
GitHub has revoked npm classic tokens for publishing; maintainers must migrate, but OpenJS warns OIDC trusted publishing still has risky gaps for critical projects.