Tuesday, April 2, 2013

Maven YUI Compressor: how to remove line breaks

I have used YUI Compressor for Maven for my jQuery Vortex project. Although the files were correctly minified and obfuscated, the plugin kept all the line breaks, like this:
var k=0;
var m=false;
var w=b(d);
var j=[];
var c=[];
var e=this;
var l=-1;
var h=[];
var v=false;
var g=[];
If you want all the output being written on a single line, the plugin must be configured with:
<configuration>
    <linebreakpos>-1</linebreakpos>
</configuration>
which produces the wanted output:
var k=0;var m=false;var w=b(d);var j=[];var c=[];var e=this;var l=-1;var h=[];var v=false;var g=[];