在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):Josiah/gulp-cachebust开源软件地址(OpenSource Url):https://github.com/Josiah/gulp-cachebust开源编程语言(OpenSource Language):JavaScript 100.0%开源软件介绍(OpenSource Introduction):gulp-cachebust
Useful for cachebusting InstallInstall with npm
Examplevar gulp = require('gulp');
var CacheBuster = require('gulp-cachebust');
var cachebust = new CacheBuster();
gulp.task('build-css', function () {
return gulp.src('styles/*.css')
// Awesome css stuff
.pipe(cachebust.resources())
.pipe(gulp.dest('dist/css'));
});
gulp.task('build-html', ['build-css'], function () {
return gulp.src('templates/*')
// Awesome html stuff
.pipe(cachebust.references())
.pipe(gulp.dest('dist'));
}); APInew CacheBuster(options)options.checksumLengthOptional Type: options.randomGenerates the checksum based on a random sha1 hash and not on the file contents. Optional Type: options.pathFormatterSpecify a custom formatting function for busted paths. The default will output
filenames like Optional Type: An example for outputing a custom hash prefix: {
pathFormatter: function(dirname, basename, extname, checksum) {
return require('path').join(dirname, basename + '._v' + checksum + extname);
}
} CacheBuster.resources()Renames and collects resources according to their MD5 checksum. CacheBuster.references()Rewrites references to resources which have been renamed according to their MD5 checksum. LicenseMIT © Josiah Truasheim |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论