grh

gulp-resource-hash

A gulp plugin for cache files by adding a hash version append their name(like a.js?v=hash)

Showing:

Popularity

Downloads/wk

18

GitHub Stars

2

Maintenance

Last Commit

6yrs ago

Contributors

2

Package

Dependencies

2

Size (min+gzip)

26.0KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

gulp-resource-hash

A gulp plugin for cache files by adding a hash version append their name(like a.js?v=hash).

Install

npm install --save-dev gulp-resource-hash

Examples

Default

var gulp = require('gulp');
var staticHash = require('gulp-resource-hash');

gulp.task('resource-hash-html', function () {
    gulp.src('static/**/*.html')
        .pipe(staticHash({asset: 'static'}))
        .pipe(gulp.dest('dest'));
});

Input:

<link rel="stylesheet" href="main.min.css">
<script src="main.min.js"></script>
<img src="main.png" />

Output:

<link rel="stylesheet" href="main.min.css?v=8501b2b">
<script src="main.min.js?v=8501b2b"></script>
<img src="main.png?v=8501b2b" />

Options

asset: 'static'

The path to assets in your project

exts: ['js', 'css', 'png']

The extension list need add hash version

md5BuildAsset: 'static'

The path to assets in your project used by create md5 file

urlParamName: 'v'

自定义 URL 参数

isAdditionExt: false

是否在 URL 末尾附加原文件的扩展名

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100