davidB / yuicompressor-maven-plugin

maven's plugin to compress (Minify / Ofuscate / Aggregate) Javascript files and CSS files using YUI Compressor
http://davidb.github.io/yuicompressor-maven-plugin/
GNU Lesser General Public License v2.1
122 stars 48 forks source link

Aggregate Minification retains linebreaks #53

Closed Benxamin closed 12 years ago

Benxamin commented 12 years ago

When I run the plugin, the resulting minified files (prior to concatenation) have CSS rules compressed down to one line for each rule. The JS files have no extra whitespace (no indentation, no double-spaced lines). Yet they retain one line for each line of code. The resulting files contain hundreds of lines, instead of just one.

After the aggregation, the files do not are still not fully compressed. They retain all the line breaks. The only setting I found that affects line breaks is the configuration setting. And it only works on aggregated files.

When you set that value to an arbitrarily high number (999999), then it will allow the aggregated files to consist of just one line. It does not operate on the "minified" files before aggregation.

It would be better to have another variable that toggles this line breaks feature. I can see the value of getting this plugin running–and not fully minifying the code–in a development environment. However, it's not what we require for production, and it's not what we expect when using YUI Compressor.

I prefer to have the line breaks stripped with the rest of the white space. And it would be nice to see this operate on each file, prior to aggregation.

true Here are the working setting from my pom.xml: ``` net.alchim31.maven yuicompressor-maven-plugin 1.1 compress true true 999999 .min false ${project.build.directory}/${project.build.finalName}/resources/js/global.min.js ../html5/canvasDefault.min.js ${project.build.directory}/${project.build.finalName}/resources/stylesheet/base.min.css ../css/demo_template.min.css ../css/override_header.min.css ../css/override_styles.min.css ../css/screen.min.css ../css/showcase_styles.min.css ```
pkuczynski commented 12 years ago

You are using pretty old version of the plugin. If you would upgrade to 1.3.1 and use -1 it should remove all line breaks. Check CHANGELOG file.

Version 1.3.1 is not available in Maven Central yet, but should be pretty shortly. If you in a hurry, you can build whats currently in the repo, but then use 1.3.2-SNAPSHOT as a version.

Let us know if that solved your problem?

pkuczynski commented 12 years ago

Check 1.3.2. Its available in Maven Central now.