diff --git a/Gruntfile.js b/Gruntfile.js index a26a159..e5a0639 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -65,7 +65,8 @@ module.exports = function(grunt) { extractDeclared: function(filepath) { return [filepath]; }, - onlyConcatRequiredFiles: true + onlyConcatRequiredFiles: true, + exportConcatenationOrder: undefined } } }, diff --git a/README.md b/README.md index a69491a..01cceb0 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,9 @@ grunt.initConfig({ this is a default function that extracts declared modules names from file content extractDeclared: function (filepath, filecontent) { return this.getMatches(/declare\(['"]([^'"]+)['"]/g, filecontent); - } + }, + export the path of all concated files in their concatenation (newline seperated) to this file + exportConcatenationOrder: undefined */ }, files: { diff --git a/tasks/concat_in_order.js b/tasks/concat_in_order.js index 06a75c7..0901c4a 100644 --- a/tasks/concat_in_order.js +++ b/tasks/concat_in_order.js @@ -163,6 +163,11 @@ module.exports = function (grunt) { }).join(EOL)); grunt.log.writeln('File "' + fileSet.dest + '" created.'); + + if (options.exportConcatenationOrder) { + grunt.file.write(options.exportConcatenationOrder, ordered.map(item => item.file).join("\n")); + grunt.log.writeln('Concatenation order exported to "' + options.exportConcatenationOrder + '".'); + } }); });