umeruma / gulp-cache-break

Simple cache-breaker for gulp, appends a timestamp or md5 hash to any urls.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gulp-cache-break

Simple cache-breaker plugin for gulp, appends a timestamp or md5 hash to any urls.

This plugin based on cache-breaker.

You can customize output strings by changing option.

Please refer to cache-breaker, and grunt-cache-breaker.

Usage

<!-- input index.html -->
<meta charset="utf-8">
<title>CACHE BREAK</title>
<link rel="stylesheet" href="css/main.css">
<script defer src="js/libs.js"></script>
<script defer src="js/main.js"></script>
// gulp setting
var cacheBreak = require('gulp-cache-break');

gulp.task('cache-breake', function() {
  gulp.src(['index.html'])
    .pipe(cacheBreak({
      match: ['main.js', 'main.css']
    }))
    .pipe(gulp.dest('public'));
});
<!-- output public/index.html -->
<meta charset="utf-8">
<title>CACHE BREAK</title>
<link rel="stylesheet" href="css/main.css?rel=1438015738280">
<script defer src="js/libs.js"></script>
<script defer src="js/main.js?rel=1438015738280"></script>

About

Simple cache-breaker for gulp, appends a timestamp or md5 hash to any urls.


Languages

Language:JavaScript 100.0%