
Security News
Open Source CAI Framework Handles Pen Testing Tasks up to 3,600× Faster Than Humans
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
gulp-checksum
Advanced tools
Checksum static resources and optionally update the references in HTML files to match.
Generates checksums out of static resources and renames the files accordingly - this makes a unique filename for each version of the file so that HTTP headers can be set to cache forever.
Can also update references to the resources with checksum using the references()
call, just make sure that all calls to resources()
is done before. gulp-checksum assumes HTML, and so looks for references in href
and src
attributes.
gulp-checksum correctly handles relative URLs, even if multiple resources in the tree have the same filename.
var gulp = require('gulp');
var checksum = require('gulp-checksum');
gulp.task('css', function () {
return gulp.src('css/*.css')
.pipe(checksum.resources())
.pipe(gulp.dest('dist/css'));
});
gulp.task('html', ['css'], function () {
return gulp.src('*.html')
.pipe(checksum.references())
.pipe(gulp.dest('dist'));
});
gulp-checksum stores references as absolute paths internally, so it's important to call resources()
and references()
at the same point in the chain, so that paths will still match up. Also note that sourcemaps.write()
is called after the rename, so that names will match properly.
Source SASS files are in a scss/
path but will be output under css/
and the result from Mustache will have new file ending .html
.
var gulp = require('gulp');
var path = require('path');
var checksum = require('gulp-checksum');
var sass = require('gulp-sass');
var rename = require('gulp-rename');
var mustache = require('gulp-mustache');
var sourcemaps = require('gulp-sourcemaps');
gulp.task('sass', function () {
gulp.src('scss/*.scss')
.pipe(sourcemaps.init())
.pipe(sass({outputStyle: 'compressed'}))
.pipe(rename(function (path) {
path.dirname = path.dirname.replace(/\bscss\b/, 'css');
}))
.pipe(checksum.resources())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(config.targetPath));
});
gulp.task('mustache', ['sass'], function () {
gulp.src('templates/*.mustache')
.pipe(mustache())
.pipe(replace(/\bscss\/branding.scss\b/, 'css/branding.css'))
.pipe(rename(function (path) {
path.extname = '.html';
}))
.pipe(checksum.references())
}
});
npm test
FAQs
Checksum static resources and optionally update the references in HTML files to match.
The npm package gulp-checksum receives a total of 25 weekly downloads. As such, gulp-checksum popularity was classified as not popular.
We found that gulp-checksum demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.