Socket
Socket
Sign inDemoInstall

gulp-filename-hash

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    gulp-filename-hash

append md5 string to filename or path as a query parameter


Version published
Maintainers
1
Install size
4.28 kB
Created

Readme

Source

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.

Keywords

FAQs

Last updated on 04 May 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc