When minifying JavaScript, wouldn't it work just as well to put each statement on a new line instead of on one line with semicolons?
When minifying JavaScript, wouldn't it work just as well to put each statement on a new line instead of on one line with semicolons?
This is of course assuming you don't have to maintain support for extremely old browsers that actually require semicolons in JavaScript, which you probably don't. Basically, a semicolon and a newline character (edit: I should clarify that I mean the Unix-style LF as opposed to Windows's CRLF, every reasonably modern web browser should understand the former even if it's on Windows) take up the same amount of bytes in both ASCII and UTF-8, so does it really matter if each statement in a minified file is separated by a new line or a semicolon? There is also a benefit to using new lines where it's at least somewhat human readable (albeit without indents) instead of almost completely unreadable if everything was on one line. So why aren't there any minifiers that produce new line separated files?