1.0.9 • Published 8 years ago

gulp-version-replace v1.0.9

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

8 years ago

1.0.8

8 years ago

1.0.7

8 years ago

1.0.68

8 years ago

1.0.67

8 years ago

1.0.66

8 years ago

1.0.65

8 years ago

1.0.64

8 years ago

1.0.63

8 years ago

1.0.61

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.111

8 years ago

1.0.11

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago