• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

gulp-file-rev: 一个用于资源版本修订及引用路径替换的 gulp 插件。 ...

原作者: [db:作者] 来自: 网络 收藏 邀请

gulp-file-rev

Build StatusCoverage StatusVersionLicenseDependenciesDevDependencies

A gulp plugin to revise files and replace references with new paths.

Usage

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'));});

API

fileRev(options)

options

Type: Object

options.hashLength

The length of the hash.

Type: Number

Default: 8

options.separator

The separator between the filename and hash.

Type: String

Default: .

options.algorithm

The algorithm function to calculate the content hash.

Type: Function

Default: fileRev.md5

options.queryMode

If true, the plugin will put the hash to the query string instead of the filename.

Type: Boolean

Default: false

options.prefix

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: ``

options.cwd

Current working directory for prefix prepending, only has an effect if options.prefix is provided.

Type: String

Default: process.cwd()


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
gulp: 用gulp编译less,压缩css,压缩js,版本控制等等发布时间:2022-02-13
下一篇:
gulp-html-resource: html模板资源配置自动化发布时间:2022-02-13
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap