Skip to content

Instantly share code, notes, and snippets.

@alebianco
Created May 5, 2016 15:50
Show Gist options
  • Save alebianco/24cdfa60fa517565d2240c4a770a69fe to your computer and use it in GitHub Desktop.
Save alebianco/24cdfa60fa517565d2240c4a770a69fe to your computer and use it in GitHub Desktop.
grunt-run-task issue #5
module.exports = function (grunt) {
grunt.initConfig({});
grunt.registerTask('test', 'testing grunt-run-task', function() {
var runTask = require('grunt-run-task');
runTask.loadNpmTasks("grunt-fileindex");
function createConfig(folder) {
return {
resources: {
options: {
format: 'json_flat',
pretty: true
},
files: [{
src: '**/*.*',
dest: folder + '/resources.json'
}]
}
};
}
function indexFiles(config) {
console.log("running task");
runTask('fileindex:resources', config, function (error, task) {
if (error) {
console.error(error);
}
console.log("task complete");
});
}
// expected: should create a resources.json file with a list of all files in five different folders
// actual: some folders are created, the "done" callback is never called
var folders = ["one", "two", "three", "four", "five"];
folders.map(createConfig).forEach(indexFiles);
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment