I want to compress js files and convert into single line at the time of loading using php.when I removes the spaces with 'preg_replace' an error occurs, ';' missing in line 234. The cause is some lines are not ending with ';'.For eg
var flag='value' // here not ended with ';'
var test='value';
And when I minifies, it looks like
var flag='value' var test='value';
So error occurs.
How can I minify js files with some lines not ending with ';'