I've beeing using YUI Compressor to minify JS files. I have this code:
(function(global) {
"use strict";
var X=1;
/*** my code here ***/
}(window));
And I compress it with this command:
$> java -jar yuicompressor-2.4.7.jar test.js -o test.min.js --verbose
The "use strict" hint is not present in the compressed output file. It seems that YUI removes all hints. And it output this warning:
[WARNING] Invalid hint syntax: use strict
(function(global){ ---> "use strict" <--- ;var X=1;...
Although, my code works fine after compression, I'd like to know if there is an argument to YUICompressor to preserve the hints and/or a way to avoid that warning.
Any advice? Thanks.
A partial explanation can be found here. Although that question is about closure compiler the answer gives you a hint (as Google also had this issue). In Closure it is possible to use --language_in=ECMASCRIPT5_STRICT
Unfortunately up to now there has been no such thing for the YUI Compressor. At least I could not find anything like that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With