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

Configuration of gzip compression level #81

Open cdanger opened 9 years ago

cdanger commented 9 years ago

Hello, is there a way to configure gzip compression level? When using true</gzip with compress goal. Or at least allow to use the max level (lowest speed). For instance, the linux gzip command supports 9 levels (9 being the best compression level but slowest compression method).

Thanks.

davidB commented 9 years ago

Today, there is no way to configure it. The plugin use java GZIPOutputStream, if you find a way to set the compression (reliable), tell me or made a Pull Request.

cdanger commented 9 years ago

Yes, there is some help here: https://weblogs.java.net/blog/2003/12/26/achieving-better-compression-deflater In short, instead of:

GZIPOutputStream gzipout = new GZIPOutputStream(bos);

use

OutputStream gzipout = new GZIPOutputStream(bos){{def.setLevel(Deflater.BEST_COMPRESSION);}};

I have not tested it myself, but it is used by others.