diff --git a/README.md b/README.md index 4de79f6..9d785ab 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/tasks/filerev.js b/tasks/filerev.js index 9b94ab7..b0caa8a 100644 --- a/tasks/filerev.js +++ b/tasks/filerev.js @@ -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;