
Product
Introducing Repository Labels and Security Policies
Socket is introducing a new way to organize repositories and apply repository-specific security policies.
gulp-rev-rewrite
Advanced tools
Rewrite references to assets that have been revisioned using gulp-rev
Effortlessly rewrite references to revisioned assets by incorporating gulp-rev-rewrite
into your revisioning workflow powered by gulp-rev
.
npm install gulp-rev-rewrite --save-dev
In this approach, revisioning and rewriting are done in a single gulp task.
import gulp from 'gulp';
import rev from 'gulp-rev';
import revRewrite from 'gulp-rev-rewrite';
function revision() {
return gulp.src('dist/**/*.{css,js}')
.pipe(rev())
.pipe(gulp.src('dist/**/*.html'))
.pipe(revRewrite())
.pipe(gulp.dest('dist'));
}
export default revision;
This approach separates asset revisioning from rewriting references to the revisioned assets.
import { readFileSync } from 'node:fs';
import gulp from 'gulp';
import rev from 'rev';
import revRewrite from 'gulp-rev-rewrite';
// Step 1: Asset revisioning
function revision() {
return gulp.src('dist/assets/**/*.{css,js}')
.pipe(rev())
.pipe(gulp.dest('dist/assets'))
.pipe(rev.manifest())
.pipe(gulp.dest('dist/assets'));
}
// Step 2: Rewriting references
function rewrite() {
const manifest = readFileSync('dist/assets/rev-manifest.json');
return gulp.src('dist/**/*.html')
.pipe(revRewrite({ manifest }))
.pipe(gulp.dest('dist'));
}
export default gulp.series(revision, rewrite);
Type: Object
Type: Buffer
(e.g., fs.readFileSync()
)
Read JSON manifests generated by gulp-rev
. This allows replacing filenames that were revisioned in a previous task.
MIT © Thomas Vantuycom
FAQs
Rewrite references to assets that have been revisioned using gulp-rev
The npm package gulp-rev-rewrite receives a total of 2,418 weekly downloads. As such, gulp-rev-rewrite popularity was classified as popular.
We found that gulp-rev-rewrite demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket is introducing a new way to organize repositories and apply repository-specific security policies.
Research
Security News
Socket researchers uncovered malicious npm and PyPI packages that steal crypto wallet credentials using Google Analytics and Telegram for exfiltration.
Product
Socket now supports .NET, bringing supply chain security and SBOM accuracy to NuGet and MSBuild-powered C# projects.