serg472 / htmlcompressor

HTML Compressor and Minifier, can be used standalone and as a Java library
Apache License 2.0
40 stars 14 forks source link

How to use the htmlcompressor? #86

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hello,

I downloaded the file "htmlcompressor-1.5.3.jar" but I do not know how to 
compress HTML. Can someone post a step by step? I am using Windows 7

Thanks!

Original issue reported on code.google.com by thiagonu...@gmail.com on 3 Jul 2013 at 9:08

GoogleCodeExporter commented 9 years ago
If you are using maven, look at this plugin...otherwise, 

https://github.com/TUNYK/htmlcompressor-maven-plugin‎

<plugin>                    <groupId>com.tunyk.mvn.plugins.htmlcompressor</groupId>
<artifactId>htmlcompressor-maven-plugin</artifactId>
<version>1.3</version>
</plugin>

If you are using ant, look at yui-compressor-ant-task. 

yui-compressor-ant-task

I worked on yui-compressor-ant-task to bring htmlcompressor support to it.  You 
can do it separately but it is slow without using this task.  In addition to 
html compression it will give you css/javascript compression as well.  If using 
maven, there is a separate plugin for css/javascript and with maven both are 
rather fast.

Both of the above will get compression completed even against jsp/jsf fragments 
prior to build.  I believe it was stated on this site not to do such a thing 
but it does partually work and works well.  While doing so at build won't get 
full compression potential, it goes a long way to make things such as googles 
page speed see this as properly compressed.  I use JSF and was unable to get it 
working through code.  So I simply went with the build process solution and 
have been satisfied with it.

Original comment by hazen...@gmail.com on 25 Jul 2013 at 1:03