grunt-md5-list

Copy files to a specified directory, according to the MD5 Rename, and then generate a file path and hash correspondence between documents.

grunt-md5-list

Copy files to a specified directory, rename to hash, and then generate JSON file that recode the key-value of file path and hash.

拷贝文件到指定目录,根据MD5重命名,然后生成一个文件路径和hash对应关系的文档。

This plugin requires Grunt ~0.4.1

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-md5-list --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-md5-list');

In your project's Gruntfile, add a section named md5_list to the data object passed into grunt.initConfig().

grunt.initConfig({
  md5_list: {
    options: {
      // Task-specific options go here. 
    },
    your_target: {
      // Target-specific file lists and/or options go here. 
    },
  },
})

Type: String Default value: ''

will output in the result file. This is useful when you want to tell the PHPer the CDN url.

Type: String Default value: 'md5'

A string value that specific algorithm to generate hash.

Type: String Default value: 'utf8'

A string value that specific file encoding.

Type: String Default value: 'dist.json'

A string value that specific the output file.

Type: String Default value: 'false'

A Boolean value that whether the generated key-value Object is sorted by the key.

grunt.initConfig({
  md5_list: {
    options: {},
    files: {
      expand: true,
      cwd: TEMP_DIR,
      src: ['js/**/*.js', 'css/**/*.css'],
      dest: 'dist/'
    },
  },
})
grunt.initConfig({
  md5_list: {
    options: {
      'prefix': 'http://cdn-url.com/xxx/',
      algorithm: 'sha1',
      output: 'assets.json'
    },
    files: {
      expand: true,
      cwd: TEMP_DIR,
      src: ['js/**/*.js', 'css/**/*.css'],
      dest: 'dist/'
    },
  },
})

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

2013-07-31 0.2.0

First version.

2014-01-13 0.4.0

add sortByKey options

2014-01-13 0.4.1

add test case

2014-01-13 0.4.2

add Travis CI build status badge, update dependencies

2014-01-13 0.4.2

add extname output; add prefix option.