0.2.1 • Published 8 years ago

gulp-filename-hash v0.2.1

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

8 years ago

0.2.0

8 years ago

0.0.1

8 years ago

0.1.5

8 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago