1.0.9 • Published 10 years ago

gulp-version-replace v1.0.9

Weekly downloads
30
License
MIT
Repository
github
Last release
10 years ago

gulp-version-replace

gulp plugin for cache-busting files using query string file hash

installation

$ npm install gulp-version-replace --save-dev

how?

gulpfile.js

var gulp = require('gulp');
var repV = require('gulp-version-replace');

gulp.task('rev', function () {
    var re = /href=\"{!! asset\(\'(.*)\?rev=(.*)\'\) !!}/gi;
    gulp.src('test/**/*.html')
        .pipe(repV({regRxp : '',path : ''}))
        .pipe(gulp.dest('dist'));
});
<!doctype html>
<html>
  <head>
    <link rel="stylesheet" type="text/css" href="style/style-one.css?rev=@@hash">
    <script src="script/script-one.js?rev=@@hash"></script>
    <script src="script/script-two.js"></script>
  </head>
  <body>
    <div><p>hello, world!</p></div>
    <script src="script/script-three.js?rev=@@hash"></script>
  </body>
</html>

will turn into something similar as the following after running gulp-version-replace:

<!doctype html>
<html>
  <head>
    <link rel="stylesheet" type="text/css" href="style/style-one.css?rev=d65aaba987e9c1eefeb4be9cfd34e0de">
    <script src="script/script-one.js?rev=17a5da6c8a2d875cf48aefb722eefa07"></script>
    <script src="script/script-two.js"></script>
  </head>
  <body>
    <div><p>hello, world!</p></div>
    <script src="script/script-three.js?rev=5cadf43edba6a97980d42331f9fffd17"></script>
  </body>
</html>
1.0.9

10 years ago

1.0.8

10 years ago

1.0.7

10 years ago

1.0.68

10 years ago

1.0.67

10 years ago

1.0.66

10 years ago

1.0.65

10 years ago

1.0.64

10 years ago

1.0.63

10 years ago

1.0.61

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.111

10 years ago

1.0.11

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago