3 ms·
I’ve never personally minified JavaScript, with or without semicolons, but the article “Semicolons in JavaScript are optional” linked to in the page says the au
by roryokane 16y ago
I’ve never personally minified JavaScript, with or without semicolons, but the article “Semicolons in JavaScript are optional” linked to in the page says the author minified jQuery without semicolons with Google Closure Compiler, and the test suite passed. Is that article wrong? Did minifying semicolons use to work, but they removed that feature for some reason? Does no one actually use Closure Compiler, and the other minifiers don’t support missing semicolons? Or is the reason the plugin you found “blows up” simply the error described in “Semicolons in JavaScript are optional” in the section “The only real pitfall when coding without semicolons”, which is starting a line with “(d + e)” instead of “;(d + e)”?
That article says that if a minifier doesn’t understand JavaScript that an actual JavaScript interpreter can understand, the minifier is buggy. I agree with it – if your minifier messed up the semicolon-less jQuery plugin, and if none of the situations I mentioned above was the case, then your minifier needs fixing, or you should start using a different one.