0.2.0 • Published 8 years ago

gulp-hash-cachebuster v0.2.0

Weekly downloads
5
License
MIT
Repository
github
Last release
8 years ago

gulp-hash-cachebuster

Cachebusting plugin for Gulp.

Build Status Dependency Status

Install

npm install gulp-hash-cachebuster --save-dev

Features

Parses html and uses the MD5-sum of each asset as hash param.

<link rel="stylesheet" href="css/hello.css">
<script src="hello.js"></script>

Becomes

<link rel="stylesheet" href="css/hello.css?hash=08c84b1b1dbe491f09c7c566d7aa7e20">
<script src="hello.js?hash=b251ed91e4a2f97555dabf78b8266c77"></script>

Use

var gulp = require('gulp');  
var gutil = require('gulp-util');
var cachebust = require('gulp-hash-cachebuster');  

gulp.task('cachebust', function () {
    return gulp.src('./build/*.html')
        .pipe(cachebust())
        .on("warning", function(message){
            // Log missing assets
            gutil.log(gutil.colors.red(message));
        })
        .pipe(gulp.dest('./build/'));
});

Test

npm install -g mocha
npm test