Registry / devops / grunt-cache-crusher

grunt-cache-crusher

JSON →
library2.0.0jsnpmunverified

Grunt plugin for cache busting by appending timestamps or MD5 hashes to asset URLs in HTML files. Based on grunt-cache-breaker. Current version 2.0.0, requires Grunt ~0.4.1 and Node >= 0.8.0. No active development since 2015, considered legacy. Differentiators: supports timestamp query strings, filename-based replacements, and MD5 hashing of file contents to invalidate caches only when files change. Works with Grunt 0.4.x only.

npm install grunt-cache-crusher
INSTALL
IMPORT
SIG · GRUNT-CACHE-CRUSHE
G
grunt-cache-crusher
devopsjavascriptv2.0.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.

cachebreaker
grunt.initConfig({ cachebreaker: { ... } }); grunt.loadNpmTasks('grunt-cache-crusher');
grunt.loadNpmTasks('grunt-cache-breaker');
Use grunt-cache-crusher, not grunt-cache-breaker. Grunt 0.4.x only.

Gruntfile configuring cachebreaker to replace asset URLs with MD5 hashes in index.html.

module.exports = function(grunt) { grunt.initConfig({ cachebreaker: { dev: { options: { match: ['all.min.js', 'core.min.css'], replacement: 'md5', src: { path: 'public/js/all.min.js' } }, files: { src: ['public/index.html'] } } } }); grunt.loadNpmTasks('grunt-cache-crusher'); grunt.registerTask('default', ['cachebreaker']); };
Debug
Known issues
deprecatedPackage is deprecated; no updates since 2015. Use modern alternative like gulp-cache-bust or webpack caching.
fix
Migrate to a modern build tool (webpack, gulp) with cache busting.
affects: >=1.0.0
breakingGrunt ~0.4.1 only, not compatible with Grunt 1.x.
fix
Stay on Grunt 0.4.x or use a different cache-busting tool.
affects: >=2.0.0
gotchaIf using `replacement: 'md5'`, you must specify `src.path` to the actual file for hashing. Missing this causes errors.
fix
Ensure each match entry has a corresponding src object with path.
affects: >=1.0.0
gotchaPosition 'overwrite' requires glob patterns in match (e.g., 'all.*.js') to replace correctly. Incorrect patterns will not match.
fix
Use * as placeholder for the replaced segment.
affects: >=1.0.0
Errors
Common errors & fixes
Warning: Task "cachebreaker" not found. Use --force to continue.
Grunt not properly loading the plugin task.
fix
Add grunt.loadNpmTasks('grunt-cache-crusher'); to Gruntfile.
Running "cachebreaker:dev" (cachebreaker) task Fatal error: Unable to read file "" (Error code: ENOENT).
Missing or incorrect src.path when using replacement: 'md5'.
fix
Provide a valid path to the file to be hashed in options.src.path.
Warning: Invalid options, `match` must be an array. Use --force to continue.
match option is not an array.
fix
Set options.match to an array of strings or objects.
Warning: Cannot find module 'path' Use --force to continue.
Node.js built-in module 'path' missing (unlikely) – possibly environment issue.
fix
Ensure Node.js is installed correctly (v0.8+).
Upgrade
Version history
2.0.0latest on npm
Audit
Dependencies
gruntrequiredPeer dependency - Grunt ~0.4.1 required
Agent activity
6 hits · last 30 days
node
6
Resources
grunt-cache-crusher — npm install grunt-cache-crusher · libregistry