Registry / devops / grunt-cache-bust

grunt-cache-bust

JSON →
library1.7.0jsnpmunverified

Grunt plugin for cache busting static assets by appending content hashes to filenames. Current stable version is 1.7.0 (last release ~2018). It hashes files (default MD5) and replaces references in HTML/CSS/JS. Unlike other cache busting tools, it supports all file types and includes CDN support. Beware: v1.0.0 introduced breaking changes; maintenance is minimal and Node.js >=0.10.0 required (may not work on modern Node). Use only if maintaining legacy Grunt projects.

npm install grunt-cache-bust
INSTALL
IMPORT
SIG · GRUNT-CACHE-BUST
G
grunt-cache-bust
devopsjavascriptv1.7.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

grunt-cache-bust
grunt.loadNpmTasks('grunt-cache-bust');
require('grunt-cache-bust');
In Gruntfile, load NPM tasks via grunt.loadNpmTasks, not require().
cacheBust
grunt.initConfig({ cacheBust: { ... } });
grunt.config('cachebust', { ... });
Task name is 'cacheBust' (capital B), not 'cachebust'.
options.assets
options: { assets: ['css/*.css', 'js/*.js'] }
options: { asset: ['css/*.css'] }
The option is 'assets' (plural), not 'asset'.

Configure grunt-cache-bust task to hash assets in 'public/' and replace references in HTML files, deleting originals after hashing.

// Gruntfile.js module.exports = function(grunt) { grunt.initConfig({ cacheBust: { dist: { options: { assets: ['css/**', 'js/**'], baseDir: './public/', deleteOriginals: true }, src: ['public/**/*.html'] } } }); grunt.loadNpmTasks('grunt-cache-bust'); grunt.registerTask('default', ['cacheBust']); };
Debug
Known issues
breakingUpgraded to v1.0.0: options changed; assets option no longer accepts a single string but an array of glob patterns.
fix
Update Gruntfile to use arrays for assets and review other options like baseDir.
affects: >=1.0.0
gotchaNode.js engines >=0.10.0 specified; may not work on Node 12+ due to removed APIs (e.g., internal fs methods).
fix
If on Node 12+, consider using an alternative or pinning to Node 10 LTS.
affects: >=0.10.0
deprecatedGrunt ecosystem is largely superseded by modern bundlers (Webpack, Vite, etc.).
fix
Migrate to build tools like Webpack with content hashing built-in.
affects: >=0.4.0
gotchaThe 'deleteOriginals' option deletes original files after creating hashed copies; may cause issues if assets are referenced with original names elsewhere.
fix
Set 'deleteOriginals: false' unless you're sure all references are updated.
affects: >=1.0.0
Errors
Common errors & fixes
Warning: Task "cacheBust" not found.
Gruntfile not loading the plugin or task name misspelled.
fix
Add grunt.loadNpmTasks('grunt-cache-bust'); and ensure task is named 'cacheBust' in config.
Fatal error: Unable to find Gruntfile.
Grunt is run from wrong directory or Gruntfile not present.
fix
Run grunt from project root where Gruntfile.js exists.
TypeError: Cannot read property 'assets' of undefined
Options object missing or assets option not defined.
fix
Set options: { assets: ['pattern'] } inside the task configuration.
Error: Cannot find module 'grunt-cache-bust'
Plugin not installed or --save-dev executed in wrong directory.
fix
Run 'npm install grunt-cache-bust --save-dev' from project root.
Upgrade
Version history
1.7.0latest on npm
Audit
Dependencies
gruntrequiredpeer dependency required to run Grunt tasks
Agent activity
6 hits · last 30 days
node
6
Resources
grunt-cache-bust — npm install grunt-cache-bust · libregistry