Score
0
Watch 3 Star 4 Fork 0

蓝飞 / gulp-file-revNodeJSMIT

Join us
Explore and code with more than 2 million developers,Free private repositories !:)
Sign up
一个用于资源版本修订及引用路径替换的 gulp 插件。 spread retract

https://npmjs.org/package/gulp-file-rev

Clone or download
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

gulp-file-rev

Build Status Coverage Status Version License Dependencies DevDependencies

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()

Comments ( 0 )

Sign in for post a comment

NodeJS
1
https://gitee.com/lanfei/gulp-file-rev.git
git@gitee.com:lanfei/gulp-file-rev.git
lanfei
gulp-file-rev
gulp-file-rev
master

Help Search

191139_cd20d5fd_5186603 191143_ebef6f8d_5186603