Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Callback Error object #21

Closed
Flo-Schield-Bobby opened this Issue · 6 comments

2 participants

Florent SCHILDKNECHT Rodolphe Stoclin
Florent SCHILDKNECHT

Hi srod,

I'm trying to implement this pretty asynchronous minifier,
I've downloaded it, required it, but the minify function always give me back the error arg, and it doesn't work.

I'm working on a node-webkit app on a windows system (the app is supposed to be available on Linux / Mac / Windows).

And I call the minifier in this way :
var minifier = require('node-minify');
[...]
new minifier.minify({
type: 'uglifyjs',
fileIn: ["C:\Users...\main.js", ...],
fileOut: "C:\Users...\app.min.js",
buffer: 1000 * 1024,
callback: function (e) {
console.log('callback error', e);
}
});

The full error object is :
Error {
killed: false,
code: 1,
signal: null
}

I was asking myself if it was caused by the absolute filepaths, but I do not have the choice, because I am working on a new created folder (created with fs.mkdirSync...).
I've tried both linux-style and windows-like filepaths (C:... and C:/...).
I create the output file and it is working, but it do not put the minified content on it.

Do you have an idea ?

Rodolphe Stoclin
Owner

Hi,

I think too, that must be the cause.
Can't you use relative path ? fileIn: ["../../main.js"]

Or maybe you already solve ? (sorry for the delay)

Florent SCHILDKNECHT

Hi, sorry for the late too, I switched projects and didn't see that notification !

And no, I didn't fix it at the moment.
But the issue I have is that I would like to minify some files who are not in the working directory !

So let's imagine the case :

  • I've got an app (so the working directory) that I launch with node-webkit. (I guess it's globaly the same effect as launching an app in CLI).

  • In this app, I'm creating a new folder, on a user-choice form (https://github.com/rogerwang/node-webkit/wiki/File-dialogs#other-types-of-dialogs) that allow to select a folder on the user laptop / desktop. Then I add some files in that new folder, that I would to minify on the fly.

Do you think it's possible without absolute links ?
It's for some internal stuff in my company, nobody really cares about security problems that some kind of application could generate :)

Thanks for your help !

Rodolphe Stoclin
Owner

And can't you copy those files in the working directory and then copy minified files in the user-choice folder ?
I don't see other solution, I think this is more a bad access to the files.

Or maybe the temp path, can you specify another path ?

new compressor.minify({
type: 'yui-js',
fileIn: 'public/js/base.js',
fileOut: 'public/js/base-min-yui.js',
tempPath: '/tmp',
callback: function(err){
console.log(err);
}
});

Florent SCHILDKNECHT

I didn't try to specify a temp path at the moment, but maybe it could be interesting for me, how is it working ?
Can I specify my new folder as the tempPath ?

I should try it I think, and let you know the result.

Rodolphe Stoclin
Owner

Indeed, all temporary files will be created in the temp folder.
Give a try :)

Florent SCHILDKNECHT

Okay very nice, I'll check that soon :)

Rodolphe Stoclin srod closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.