Socket
Socket
Sign inDemoInstall

grunt-md5vel

Package Overview
Dependencies
30
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    grunt-md5vel

Generates md5 filenames.


Version published
Weekly downloads
1
Maintainers
1
Install size
0.958 MB
Created
Weekly downloads
 

Readme

Source

grunt-md5vel

Grunt plugin for generating MD5 filenames.

Getting Started

Install this grunt plugin next to your project's grunt.js gruntfile with: npm install grunt-md5vel

Then add this line to your project's grunt.js gruntfile:

grunt.loadNpmTasks('grunt-md5vel');

Then specify what files you want to generate an md5 filename in your config:

grunt.initConfig({
  md5vel: {
    compile: {
      files: [{
        'dest/folder/': 'src/file'
      }],
      options: {
        /** `prefix`, `suffix`, `hash`, `extension`, `template` accept `string`, `function` and `object`
         * @type {String, Object, Function, void}
         * Where object is keyed by the original value, such that the destinations file extension would become `new.dist.js` with the option `{ 'js': 'new.dist.js' }` for `script.js`
         */
        prefix: '', // defaults to current basename of file,
        hash: function(hash){
          return hash.substr(0,8)
        },
        suffix: '',
        extension: 'ext' || {
          'js': 'my.js',
          'css': 'our.css'
        } 
        template: _.template(
          "<%= _.filter([prefix, hash, suffix]).join(delimiter) %>" +
          "<%= extension? '.':'' %><%= extension %>")

        /**
         * Called before determing the filename
         * @param  {Object} filename Contains filename compontents { 
         *                              prefix 
         *                              hash
         *                              suffix
         *                              extension 
         *                              template 
         *                            }
         */
        beforeEach: function (filename, options){}

        /**
         * A callback after each file is written describing the change
         * @param  {Object} fileChange {
         *                               newPath
         *                               oldPath
         *                               content
         *                             }
         */
        afterEach: function (fileChange) {},

        /**
         * A callback after all files are written with a summary of writes
         * @param  {[Object]} fileChanges [{newPath, oldPath, content}, …}]
         */
        after: function (fileChanges) {}

      }
    }
  }
});

Keywords

FAQs

Last updated on 16 Jun 2014

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