A gulp plugin to revise files and replace references with new paths.
First, install gulp-file-rev
as a development dependency:
npm install --save-dev gulp-file-rev
Then, add it to your gulpfile.js
:
var gulp = require('gulp');
var gulpIf = require('gulp-if');
var fileRev = require('gulp-file-rev');
gulp.task('default', function() {
var revision = fileRev();
return gulp
.src('**/*')
// revise files
.pipe(gulpIf('**/*.{jpg,png,gif}', revision))
// replace references
.pipe(gulpIf('**/*.{html,css,js}', revision.replace))
.pipe(gulp.dest('dist'));
});
Type: Object
The length of the hash.
Type: Number
Default: 8
The separator between the filename and hash.
Type: String
Default: .
The algorithm function to calculate the content hash.
Type: Function
Default: fileRev.md5
If true
, the plugin will put the hash to the query string instead of the filename.
Type: Boolean
Default: false
The prefix to prepended to the file path, which is usually used to prepend the CDN host. Please notice that you should set options.cwd
properly.
Type: String
Default: ``
Current working directory for prefix prepending, only has an effect if options.prefix
is provided.
Type: String
Default: process.cwd()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
1. 开源生态
2. 协作、人、软件
3. 评估模型