Minification doesn't support synchronous execution
Closed this issue · 3 comments
Hi,
I need to use node-minify in a project, but it only calls asynchronous execution of child processes to do the actual minification work. This is an issue for me, since in my code structure I need it to be done synchronously.
Is it possible to support something like a {sync: true}
option, defaulting to false
, so that it's run synchronously when the client code requests it?
Hi,
I have published version 1.2.0, can you give it a try ?
So, you have to pass the sync: true option.
new compressor.minify({
type: 'yui-js',
publicFolder: 'public/js/',
fileIn: 'base.js',
fileOut: 'public/js-dist/base-min-yui-publicfolder.js',
sync: true,
callback: function(err, min) {
console.log('YUI JS with publicFolder option');
console.log(err);
//console.log(min);
}
});
Thanks !
Hi @srod , thanks a lot for the fix! I unfortunately had to move to UglifyJS directly, but I'll try it in the future if I end up needing it again. :-)
Thanks a bunch for the quick fix, btw! Awesome!
Edit: My issue was with the upgrade process of npm
The sync option works great, thanks for providing it, it was really really needed
I was using node-minify with sync assumption, somehow things never failed, I guess I was pretty lucky