Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check javascript for missing ";" before compression

I'm doing some optimizations and decided to compress my javascript files using YUI Compressor. The problem is, that some code lines are missing ";" at the end, since javascript allows that and developers do not look too much at this.

Is it going to be a problem when code is compressed? If it is, is there a way to check javascript for lines that are missing ";"?

like image 663
Silver Light Avatar asked Jan 28 '11 09:01

Silver Light


2 Answers

jsLint can check your code for that. And yes it will most likely cause issues unless the compressor actually contains a JavaScript parser and actively fixes missing semicolons.

like image 91
ThiefMaster Avatar answered Oct 14 '22 01:10

ThiefMaster


According to this SO answer, YUI Compressor can handle it.

like image 39
Jon Avatar answered Oct 14 '22 01:10

Jon