JSPM

gulp-hash-cachebuster

0.2.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q35110F
  • License MIT

Cachebuster plugin for gulp

Package Exports

  • gulp-hash-cachebuster

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (gulp-hash-cachebuster) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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