Git Product home page Git Product logo

gulp-resource-hash's Introduction

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

gulp-resource-hash's People

Contributors

hex-ci avatar anhulife avatar simon04 avatar

Stargazers

Márk Bartos avatar  avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.