1.0.9 • Published 6 years ago

gulp-version-replace v1.0.9

Weekly downloads
30
License
MIT
Repository
github
Last release
6 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

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.68

6 years ago

1.0.67

6 years ago

1.0.66

6 years ago

1.0.65

6 years ago

1.0.64

6 years ago

1.0.63

6 years ago

1.0.61

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.111

6 years ago

1.0.11

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago