Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are there any javascript minifiers that preserve line breaks?

Error reporting from the client that always reports an error on line 1 (because the file is minified) is not very useful. I'd like to minify my code while preserving line breaks so that I get meaningful line numbers.

Are there any javascript minifiers that have an option to preserve line breaks?

like image 295
Jordan Avatar asked Jun 01 '12 17:06

Jordan


2 Answers

Take a look at closure compiler from Google with pretty print option enabled

There are also plenty of options if you use the command line tool.

like image 158
Fabien Avatar answered Oct 02 '22 16:10

Fabien


I've been looking for the same thing and although I've not found exactly what I want, I've just seen that the (now deprecated) YUI Compressor has a --line-break 0 switch that causes a line break to be inserted after each semicolon. Since I was using YUI Compressor anyway, I think this will do for my debugging purposes.

like image 38
IpsRich Avatar answered Oct 02 '22 15:10

IpsRich