Installations
npm install gulp-rev-replace2
Developer Guide
Typescript
No
Module System
CommonJS
Min. Node Version
>=0.10.0
Node Version
8.11.3
NPM Version
6.3.0
Score
71.4
Supply Chain
96.2
Quality
72.8
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
ittiam
Download Statistics
Total Downloads
1,101
Last Day
1
Last Week
7
Last Month
18
Last Year
97
GitHub Statistics
1 Stars
91 Commits
1 Watching
1 Branches
1 Contributors
Package Meta Information
Latest Version
0.0.3
Package Id
gulp-rev-replace2@0.0.3
Unpacked Size
26.05 kB
Size
6.42 kB
File Count
7
NPM Version
6.3.0
Node Version
8.11.3
Total Downloads
Cumulative downloads
Total Downloads
1,101
Last day
0%
1
Compared to previous day
Last week
16.7%
7
Compared to previous week
Last month
125%
18
Compared to previous month
Last year
-19.8%
97
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
2
Dev Dependencies
5
gulp-rev-replace ![Build Status](https://travis-ci.org/jamesknelson/gulp-rev-replace.svg?branch=master)
Rewrite occurrences of filenames which have been renamed by gulp-rev
Note: this package is no longer maintained. Development continues in TheDancingCode/gulp-rev-rewrite.
Install
1$ npm install --save-dev gulp-rev-replace
Usage
Pipe through a stream which has both the files you want to be updated, as well as the files which have been renamed.
For example, we can use gulp-useref to concatenate assets in an index.html, and then use gulp-rev and gulp-rev-replace to cache-bust them.
1var gulp = require('gulp'); 2var rev = require('gulp-rev'); 3var revReplace = require('gulp-rev-replace'); 4var useref = require('gulp-useref'); 5var filter = require('gulp-filter'); 6var uglify = require('gulp-uglify'); 7var csso = require('gulp-csso'); 8 9gulp.task("index", function() { 10 var jsFilter = filter("**/*.js", { restore: true }); 11 var cssFilter = filter("**/*.css", { restore: true }); 12 var indexHtmlFilter = filter(['**/*', '!**/index.html'], { restore: true }); 13 14 return gulp.src("src/index.html") 15 .pipe(useref()) // Concatenate with gulp-useref 16 .pipe(jsFilter) 17 .pipe(uglify()) // Minify any javascript sources 18 .pipe(jsFilter.restore) 19 .pipe(cssFilter) 20 .pipe(csso()) // Minify any CSS sources 21 .pipe(cssFilter.restore) 22 .pipe(indexHtmlFilter) 23 .pipe(rev()) // Rename the concatenated files (but not index.html) 24 .pipe(indexHtmlFilter.restore) 25 .pipe(revReplace()) // Substitute in new filenames 26 .pipe(gulp.dest('public')); 27});
It is also possible to use gulp-rev-replace without gulp-useref:
1var rev = require("gulp-rev"); 2var revReplace = require("gulp-rev-replace"); 3gulp.task("revision", ["dist:css", "dist:js"], function(){ 4 return gulp.src(["dist/**/*.css", "dist/**/*.js"]) 5 .pipe(rev()) 6 .pipe(gulp.dest(opt.distFolder)) 7 .pipe(rev.manifest()) 8 .pipe(gulp.dest(opt.distFolder)) 9}) 10 11gulp.task("revreplace", ["revision"], function(){ 12 var manifest = gulp.src("./" + opt.distFolder + "/rev-manifest.json"); 13 14 return gulp.src(opt.srcFolder + "/index.html") 15 .pipe(revReplace({manifest: manifest})) 16 .pipe(gulp.dest(opt.distFolder)); 17});
API
revReplace(options)
options.canonicalUris
Type: boolean
Default: true
Use canonical Uris when replacing filePaths, i.e. when working with filepaths
with non forward slash (/
) path separators we replace them with forward slash.
options.replaceInExtensions
Type: Array
Default: ['.js', '.css', '.html', '.hbs']
Only substitute in new filenames in files of these types.
options.prefix
Type: string
Default: ``
Add the prefix string to each replacement.
options.manifest
Type: Stream
(e.g., gulp.src()
)
Read JSON manifests written out by rev
. Allows replacing filenames that were
rev
ed prior to the current task.
options.modifyUnreved, options.modifyReved
Type: Function
Modify the name of the unreved/reved files before using them. The filename is passed to the function as the first argument.
For example, if in your manifest you have:
1{"js/app.js.map": "js/app-98adc164.js.map"}
If you wanted to get rid of the js/
path just for .map
files (because they
are sourcemaps and the references to them are relative, not absolute) you could
do the following:
1function replaceJsIfMap(filename) { 2 if (filename.indexOf('.map') > -1) { 3 return filename.replace('js/', ''); 4 } 5 return filename; 6} 7 8return gulp.src(opt.distFolder + '**/*.js') 9 .pipe(revReplace({ 10 manifest: manifest, 11 modifyUnreved: replaceJsIfMap, 12 modifyReved: replaceJsIfMap 13 })) 14 .pipe(gulp.dest(opt.distFolder));
Contributors
- Chad Jablonski
- Denis Parchenko
- Evgeniy Vasilev
- George Song
- HÃ¥kon K. Eide
- Juan Lasheras
- Majid Burney
- Simon Ihmig
- Vincent Voyer
- Bradley Abrahams
License
![Empty State](/_next/static/media/empty.e5fae2e5.png)
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Score
3
/10
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More