Installations
npm install @formunauts/gulp-rev-rewrite
Developer Guide
Typescript
No
Module System
CommonJS
Min. Node Version
>=6
Node Version
12.4.0
NPM Version
6.9.0
Score
67.7
Supply Chain
98.2
Quality
75.2
Maintenance
100
Vulnerability
99.6
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
formunauts
Download Statistics
Total Downloads
2,607
Last Day
2
Last Week
3
Last Month
8
Last Year
97
GitHub Statistics
116 Commits
1 Watching
1 Branches
8 Contributors
Bundle Size
35.04 kB
Minified
10.28 kB
Minified + Gzipped
Package Meta Information
Latest Version
1.2.0
Package Id
@formunauts/gulp-rev-rewrite@1.2.0
Unpacked Size
10.42 kB
Size
4.12 kB
File Count
5
NPM Version
6.9.0
Node Version
12.4.0
Total Downloads
Cumulative downloads
Total Downloads
2,607
Last day
0%
2
Compared to previous day
Last week
200%
3
Compared to previous week
Last month
-20%
8
Compared to previous month
Last year
-61.8%
97
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
3
Dev Dependencies
7
gulp-rev-rewrite
Rewrite occurrences of filenames which have been renamed by gulp-rev
This plugin is an improved and maintained fork of gulp-rev-replace.
Install
npm install gulp-rev-rewrite --save-dev
Only LTS and current releases of Node are supported.
Usage
Pipe through a stream with both the revved files and the files containing references to them.
1const gulp = require('gulp'); 2const filter = require('gulp-filter'); 3const rev = require('gulp-rev'); 4const revRewrite = require('gulp-rev-rewrite'); 5 6gulp.task('rev', () => { 7 const assetFilter = filter(['**/*', '!**/index.html'], { restore: true }); 8 9 return gulp.src('src/**') 10 .pipe(assetFilter) 11 .pipe(rev()) // Rename all files except index.html 12 .pipe(assetFilter.restore) 13 .pipe(revRewrite()) // Substitute in new filenames 14 .pipe(gulp.dest('dist')); 15});
It is also possible to collect the revisioned filenames from JSON manifests written out by gulp-rev
. This allows for replacing filenames that were revved prior to the current task.
1const rev = require('gulp-rev'); 2const revRewrite = require('gulp-rev-rewrite'); 3const revDelete = require('gulp-rev-delete-original'); 4 5gulp.task('revision', ['dist:css', 'dist:js'], () => { 6 return gulp.src('dist/**/*.{css,js}') 7 .pipe(rev()) 8 .pipe(revDelete()) // Remove the unrevved files 9 .pipe(gulp.dest('dist')) 10 .pipe(rev.manifest()) 11 .pipe(gulp.dest('dist')); 12}); 13 14gulp.task('revRewrite', ['revision'], function() { 15 const manifest = gulp.src('dist/rev-manifest.json'); 16 17 return gulp.src('dist/index.html') 18 .pipe(revRewrite({ manifest })) 19 .pipe(gulp.dest('dist')); 20});
API
revRewrite([options])
options
Type: Object
canonicalUris
Type: Boolean
Default: true
Use canonical URIs when replacing filePaths, i.e. use a forward slash (/
) as the path segment seperator.
replaceInExtensions
Type: Array
Default: ['.js', '.css', '.html', '.hbs']
Only substitute in new filenames in files of these types.
replaceRelative
Type: Boolean
Default: true
Replace relative files like url(../image/foo.jpg)
in files with reved filename.
prefix
Type: String
Add a prefix to each replacement.
manifest
Type: Stream
(e.g., gulp.src()
)
Read JSON manifests written out by rev
. Allows replacing filenames that were
revved prior to the current task.
modifyUnreved, modifyReved
Type: Function
Modify the name of the unreved/reved files before using them. The function receives the unreved/reved filename as the first argument, and the Vinyl object of the current file as the optional second 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.includes('.map')) { 3 return filename.replace('js/', ''); 4 } 5 return filename; 6} 7 8return gulp.src('dist/**/*.js') 9 .pipe(revRewrite({ 10 manifest: manifest, 11 modifyUnreved: replaceJsIfMap, 12 modifyReved: replaceJsIfMap 13 })) 14 .pipe(gulp.dest('dist'));
License
MIT © James K Nelson, Thomas Vantuycom
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