Open grssam opened 11 years ago
What kind of compression fails? It isn't a linter, right? The JS code is valid JS, right? What kind of errors do we get?
They are all syntax errors. I did not look at them into detail yet. You can try it out at http://refresh-sf.com/yui/ .
A quick look gives me intuition that YUI compressor fails to parse ES5. It can only parse ES3. Indeed, it seems to forbid the delete
keyword as an object literal key. ES5 specifically permits an IdentifierName
there, not an Identifier
, which would forbid keywords.
Hrmm. Weird . I have minified so much code via YUI and never had an issue. I don;t think that YUI cannot parse ES5. Infact the yui compressor code itself uses delete
everywhere in the code : https://github.com/yui/yuicompressor/blob/master/nodejs/index.js
You misunderstand me. The following is valid ES5 and invalid ES3.
var foo = {
delete: "something",
get 0() { return 'zero'; }
};
Ah.. Shall we open an issue in their github repo ?
You may! Point to this bug if you want.
(I know little of their project goals for YUI compressor; maybe ES5 is simply out of scope for them.)
See the conversation at https://github.com/yui/yuicompressor/issues/98
Basically its because of Rhino,
I feel like changing the code for a tangential project which acknowledges that it is lacking is wrong. May I consider this issue closed?
How much change in our code are we talking ? If it is simply adding quotes around certain keywords, then why not go ahead and do it ?
PS: come online on IRC man!
Why not simply use a better minifier, instead of changing the project to fit through a specific incorrect minifier?
PS: I'm just back, I'm getting set up again.
It would be really nice if YUI compression worked on aulx.js and aulx-ui.js . Right now, it just gives errors and produces half-compressed code.