Skip to content
This repository has been archived by the owner on Jul 27, 2021. It is now read-only.

Commit

Permalink
add extname output; add prefix option.
Browse files Browse the repository at this point in the history
  • Loading branch information
liuweifeng committed May 11, 2014
1 parent c37646d commit ea682fb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ grunt.initConfig({

### Options

#### options.prefix
Type: `String`
Default value: `''`

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

#### options.algorithm
Type: `String`
Default value: `'md5'`
Expand Down Expand Up @@ -91,12 +97,12 @@ grunt.initConfig({
```

#### Custom Options
In this example, custom options are used to do something else with whatever else. So if the `testing` file has the content `Testing` and the `123` file had the content `1 2 3`, the generated result in this case would be `Testing: 1 2 3 !!!`

```js
grunt.initConfig({
md5_list: {
options: {
'prefix': 'http://cdn-url.com/xxx/',
algorithm: 'sha1',
output: 'assets.json'
},
Expand Down Expand Up @@ -126,3 +132,6 @@ In lieu of a formal styleguide, take care to maintain the existing coding style.
**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.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "grunt-md5-list",
"description": "Copy files to a specified directory, according to the MD5 Rename, and then generate a file path and hash correspondence between documents.",
"version": "0.4.2",
"version": "0.4.3",
"homepage": "https://github.com/liuweifeng/grunt-md5-list",
"author": {
"name": "liuweifeng",
Expand Down
5 changes: 5 additions & 0 deletions tasks/md5_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ module.exports = function(grunt) {
var cwd = f.orig.cwd || '.';
var mapping = [];
var dest = f.orig.dest;
var prefix = options.prefix;



Expand Down Expand Up @@ -92,6 +93,10 @@ module.exports = function(grunt) {
json[key] = json[key] || {};
json[key].hash = d;
json[key].time = date;
json[key].ext = extname;
if(prefix){
json[key].prefix = prefix;
}
}

//拷贝改名后的文件到dist目录
Expand Down

0 comments on commit ea682fb

Please sign in to comment.