Try adding grunt async and creating a simple index check
This commit is contained in:
parent
4a06d92741
commit
38007b19ad
1 changed files with 8 additions and 2 deletions
|
@ -18,7 +18,9 @@ module.exports = function(grunt) {
|
|||
|
||||
grunt.registerMultiTask('wkhtmltopdf', 'Your task description goes here.', function() {
|
||||
|
||||
this.files.forEach(function(file) {
|
||||
var done = this.async();
|
||||
|
||||
this.files.forEach(function(file, filesIndex) {
|
||||
|
||||
var pathlib = require('path');
|
||||
// calculate the destination directory and ensure it exists, since
|
||||
|
@ -30,7 +32,7 @@ module.exports = function(grunt) {
|
|||
}
|
||||
grunt.file.mkdir(destPath);
|
||||
|
||||
file.src.forEach(function(src) {
|
||||
file.src.forEach(function(src, srcIndex) {
|
||||
|
||||
var dest = file.dest;
|
||||
// wkhtmltopdf seems to require that the destination be a file
|
||||
|
@ -64,6 +66,10 @@ module.exports = function(grunt) {
|
|||
if (err) {
|
||||
grunt.log('>>>', err);
|
||||
}
|
||||
// if this is the last src of the last file, we are done.
|
||||
if((filesIndex+1 >= files.length) && (srcIndex+1 >= src.length)) {
|
||||
done();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue