tedious / JShrink

Javascript Minifier built in PHP
http://www.tedivm.com
BSD 3-Clause "New" or "Revised" License
751 stars 152 forks source link

proper string concatenation #88

Closed columbian-chris closed 1 year ago

columbian-chris commented 5 years ago

JShrink takes this:

var hello = 'hi ' + 'there';

and turns it into:

var hello='hi '+'there';

It is unnecessary in javascript minification to join strings with concatenation operators (plus signs). Proper minification would produce:

var hello='hi there';
tedivm commented 1 year ago

JShrink is designed to be a quick inline minifier that sacrificed perfect minification in favor of performance. It only removes whitepsace, it does not make any attempts to rewrite code- doing so would be much more complex, and honestly there's better tools out there for that (which can be run to create static bundles, where the performance isn't as much of a concern).