Created
May 5, 2016 15:50
-
-
Save alebianco/24cdfa60fa517565d2240c4a770a69fe to your computer and use it in GitHub Desktop.
grunt-run-task issue #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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