Skip to content
This repository was archived by the owner on Mar 26, 2018. It is now read-only.

Add option for manifest file #103

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ filerev: {
}
```

### Manifest file

Type: `file`

JSON file to add additional files to `grunt.filerev.summary`. Useful for hash generated fils from other tools (for example WebPack).

#### Summary

The task keeps track of all files created and its sources in a summary that is
Expand Down
14 changes: 14 additions & 0 deletions tasks/filerev.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,20 @@ module.exports = function (grunt) {
length: 8
});

if (options.manifestFile) {
if (grunt.file.isFile(options.manifestFile)) {
var manifest = grunt.file.readJSON(options.manifestFile);
for (var file in manifest) {
if (!filerev.summary[file]) {
filerev.summary[file] = manifest[file];
}
}
grunt.verbose.writeln(chalk.green('✔ ') + 'Files from ' + options.manifestFile + ' are' + chalk.gray(' added ') + 'to summary.');
} else {
grunt.fail.warn('Could not find manifest feil ' + options.manifestFile);
}
}

eachAsync(this.files, function (el, i, next) {
var move = true;

Expand Down