Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

grunt-md5vel

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-md5vel

Generates md5 filenames.

  • 0.0.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
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

Package last updated on 16 Jun 2014

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc