You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

gulp-resource-hash

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-resource-hash

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

0.1.7
latest
Source
npmnpm
Version published
Weekly downloads
4
-84.62%
Maintainers
1
Weekly downloads
 
Created
Source

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 末尾附加原文件的扩展名

Keywords

cache

FAQs

Package last updated on 07 Jan 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts