Registry / devops / gulp-cache-breaker

gulp-cache-breaker

JSON →
library1.2.0jsnpmunverified

Gulp plugin that inserts SHA1 checksums into filepaths for cache busting, by wrapping URLs in {{cache-break:url}} markers in HTML files. Version 1.2.0 is the latest but the package is no longer maintained. It supports generating cache-broken paths and optionally creating symlinks. Alternative: use a more modern task runner or bundler with built-in cache busting.

npm install gulp-cache-breaker
INSTALL
IMPORT
SIG · GULP-CACHE-BREAKER
G
gulp-cache-breaker
devopsjavascriptv1.2.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
const CacheBreaker = require('gulp-cache-breaker');
import CacheBreaker from 'gulp-cache-breaker';
Package does not ship ESM; use CommonJS require. No TypeScript definitions.
CacheBreaker.prototype.gulpCbPath
const cb = new CacheBreaker(); gulp.src('src/index.html').pipe(cb.gulpCbPath('dist'))
const cb = new CacheBreaker(); gulp.src('src/index.html').pipe(cb.gulpCbPath())
If no base path provided, defaults to process.cwd(). For most setups, pass the output directory.
CacheBreaker.prototype.symlinkCbPaths
const cb = new CacheBreaker(); gulp.task('symlink', function() { cb.symlinkCbPaths(); })
const cb = new CacheBreaker(); gulp.task('symlink', cb.symlinkCbPaths)
This method must be called after all cache-breaking pipeline runs. It creates symlinks for every cache-broken path seen.

Shows how to use gulp-cache-breaker in a Gulp task: create a CacheBreaker instance, pipe gulpCbPath, then later call symlinkCbPaths.

const gulp = require('gulp'); const CacheBreaker = require('gulp-cache-breaker'); const cb = new CacheBreaker(); gulp.task('html', function() { return gulp.src('src/index.html') .pipe(cb.gulpCbPath('dist')) .pipe(gulp.dest('dist')); }); gulp.task('symlink-cb-paths', ['html'], function() { cb.symlinkCbPaths(); });
Debug
Known issues
deprecatedPackage is no longer under active development. Use at your own risk.
fix
Consider using gulp-cachebust or switch to a bundler like webpack with content hash.
affects: >=1.0.0
gotchagulpCbPath must be called after all static resources are built, otherwise the last modified time may be incorrect.
fix
Ensure the gulp task pipeline runs cache-breaking after building assets.
affects: >=1.0.0
gotchaThe {{cache-break:url}} pattern only works in files processed by the plugin; other file types ignored.
fix
Only use these markers in files that will be piped through gulpCbPath or gulpCdnUri.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'gulp-cache-breaker'
Package not installed or missing from node_modules.
fix
Run 'npm install --save-dev gulp-cache-breaker'
cb.gulpCbPath is not a function
Forgetting to instantiate CacheBreaker with 'new'.
fix
Use 'const cb = new CacheBreaker();'
TypeError: Cannot read property 'symlinkSync' of undefined
symlinkCbPaths called before any cache-breaking pipeline has run.
fix
Ensure gulpCbPath or gulpCdnUri has been called at least once before symlinkCbPaths.
Upgrade
Version history
1.2.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
11 hits · last 30 days
node
10
Perplexity
1
Resources