Last active
December 24, 2015 01:29
-
-
Save pH200/6723772 to your computer and use it in GitHub Desktop.
coke promise
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
build_assets : function ( config, promise, type, tmp_dir ){ | |
var self = this; | |
var path = config.path[ type ]; | |
var assets = config[ type ]; | |
return promise.all( Object.keys( assets ).map( function ( group ){ | |
var input = assets[ group ].site ? assets[ group ].site.map( function ( asset ){ | |
return self.pub_dir + path + '/' + asset + '.' + type; | |
}) : []; | |
var deffered = Q.defer(); | |
var arg = { | |
input : input, | |
output : tmp_dir + group + '.' + type | |
}; | |
arg.callback = function ( err, stdout, stderr ){ | |
if( err ) deffered.reject( err ); | |
deffered.resolve(); | |
console.log( utils.$good( 'created ' ) + 'combine & minify -> ' + arg.output ); | |
}; | |
packer( arg ); | |
return deffered.promise; | |
})); | |
}, |
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
build_assets : function ( config, flow, type, tmp_dir ){ | |
var self = this; | |
var path = config.path[ type ]; | |
var assets = config[ type ]; | |
Object.keys( assets ).forEach( function ( group ){ | |
var input = []; | |
assets[ group ].site && | |
assets[ group ].site.forEach( function ( asset ){ | |
input.push( self.pub_dir + path + '/' + asset + '.' + type ); | |
}); | |
flow.parallel( function ( arg, ready ){ | |
arg.callback = function ( err, stdout, stderr ){ | |
if( err ) throw err; | |
ready(); | |
console.log( utils.$good( 'created ' ) + 'combine & minify -> ' + arg.output ); | |
}; | |
packer( arg ); | |
}, { | |
input : input, | |
output : tmp_dir + group + '.' + type | |
}); | |
}); | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment