0.2.1 • Published 9 years ago

gulp-filename-hash v0.2.1

Weekly downloads
1
License
MIT
Repository
github
Last release
9 years ago

Replace filenames with a md5 string, or append filenames with a md5 string as query parameter.

For example:

var dest = '../dist';
var hash = require('gulp-add-hash');

gulp.task('html', ['less', 'js'], function(){
  gulp.src(['**/*.src.jade'])
      .pipe(data(function() {
        return require('./data');
      }))
      .pipe(jade({pretty: false}))
      .pipe(hash({  
        query: true,
        base: dest
      }))
      .pipe(gulp.dest(dest))
});

Options:

  • query -- default: false

    • false, <link href="index.css"> ===> <link href="index_fdafda6789.css">, the filename of index.css will be changed.
    • true, <link href="index.css"> ===> <link href="index.css?v=fdafda6789">
  • base -- base dir, default: ./

  • length -- the length of md5 string, default: 10

  • ext -- allowed extensions, type: Array, default: ['.css', '.js', '.jpg', '.png', '.gif']

Note:

  • Before using the gulp-filename-hash, You must make sure that all the static files have been generated.(See Synchronous tasks with Gulp), otherwize the gulp-filename-hash will skip.
  • This gulp plugin only checks the link in href, src and url(), and then appends a md5 string to them.

0.2.1

9 years ago

0.2.0

10 years ago

0.0.1

10 years ago

0.1.5

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago