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

Unable to use closure #91

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I am using the latest version of all scripts (2014-02-16). However, the closure 
options are not yielding anything. Am I doing something wrong? Or is this a 
htmlcompressor bug

Files:
-rw-r----- 1 bharath bharath 6.4M Feb 16 18:36 compiler.jar
-rwxrw-r-- 1 bharath bharath  68K Mar  6  2012 htmlcompressor-1.5.3.jar
-rwxrw-r-- 1 bharath bharath 153K Mar  6  2012 htmlcompressor-1.5.3-javadoc.jar
-rwxrw-r-- 1 bharath bharath  16K Mar  6  2012 htmlcompressor-1.5.3-site.jar
-rwxrw-r-- 1 bharath bharath  50K Mar  6  2012 htmlcompressor-1.5.3-sources.jar
-rwxrw-r-- 1 bharath bharath  27K Mar  6  2012 
htmlcompressor-1.5.3-test-javadoc.jar
-rwxrw-r-- 1 bharath bharath  16K Mar  6  2012 
htmlcompressor-1.5.3-test-sources.jar
-rw-rw-r-- 1 bharath bharath 770K Jul 18  2013 yuicompressor-2.4.8.jar

Command:
java -jar htmlcompressor-1.5.3.jar --compress-js --compress-css --js-compressor 
yui --closure-opt-level advanced  -a  ../../www/index.full.php

Output:

================================================================================
         Setting          | Incremental Gain |    Total Gain    |  Page Size   |
================================================================================
Compression disabled      |         0 (0.0%) |         0 (0.0%) |       23,246 |
All settings disabled     |         7 (0.0%) |         7 (0.0%) |       23,239 |
Comments removed          |       900 (3.9%) |       907 (3.9%) |       22,339 |
Multiple spaces removed   |    3,114 (13.9%) |    4,021 (17.3%) |       19,225 |
No spaces between tags    |       143 (0.7%) |    4,164 (17.9%) |       19,082 |
No surround spaces (min)  |         8 (0.0%) |    4,172 (17.9%) |       19,074 |
No surround spaces (max)  |         0 (0.0%) |    4,172 (17.9%) |       19,074 |
No surround spaces (all)  |        13 (0.1%) |    4,185 (18.0%) |       19,061 |
Quotes removed from tags  |       125 (0.7%) |    4,310 (18.5%) |       18,936 |
<link> attr. removed      |        46 (0.2%) |    4,356 (18.7%) |       18,890 |
<style> attr. removed     |         0 (0.0%) |    4,356 (18.7%) |       18,890 |
<script> attr. removed    |        92 (0.5%) |    4,448 (19.1%) |       18,798 |
<form> attr. removed      |         0 (0.0%) |    4,448 (19.1%) |       18,798 |
<input> attr. removed     |         0 (0.0%) |    4,448 (19.1%) |       18,798 |
Simple boolean attributes |         0 (0.0%) |    4,448 (19.1%) |       18,798 |
Simple doctype            |         0 (0.0%) |    4,448 (19.1%) |       18,798 |
Remove js pseudo-protocol |         0 (0.0%) |    4,448 (19.1%) |       18,798 |
Remove http protocol      |        30 (0.2%) |    4,478 (19.3%) |       18,768 |
Remove https protocol     |        48 (0.3%) |    4,526 (19.5%) |       18,720 |
Compress inline CSS (YUI) |       192 (1.0%) |    4,718 (20.3%) |       18,528 |
Compress inline JS (YUI)  |     1,499 (8.1%) |    6,217 (26.7%) |       17,029 |
================================================================================

Each consecutive compressor setting is applied on top of previous ones.
In order to see JS and CSS compression results, YUI jar file must be present.
All sizes are in bytes.

Command:
java -jar htmlcompressor-1.5.3.jar --compress-js --compress-css --js-compressor 
closure --closure-opt-level advanced  -a  ../../www/index.full.php

Output:

================================================================================
         Setting          | Incremental Gain |    Total Gain    |  Page Size   |
================================================================================
Compression disabled      |         0 (0.0%) |         0 (0.0%) |       23,246 |
All settings disabled     |         7 (0.0%) |         7 (0.0%) |       23,239 |
Comments removed          |       900 (3.9%) |       907 (3.9%) |       22,339 |
Multiple spaces removed   |    3,114 (13.9%) |    4,021 (17.3%) |       19,225 |
No spaces between tags    |       143 (0.7%) |    4,164 (17.9%) |       19,082 |
No surround spaces (min)  |         8 (0.0%) |    4,172 (17.9%) |       19,074 |
No surround spaces (max)  |         0 (0.0%) |    4,172 (17.9%) |       19,074 |
No surround spaces (all)  |        13 (0.1%) |    4,185 (18.0%) |       19,061 |
Quotes removed from tags  |       125 (0.7%) |    4,310 (18.5%) |       18,936 |
<link> attr. removed      |        46 (0.2%) |    4,356 (18.7%) |       18,890 |
<style> attr. removed     |         0 (0.0%) |    4,356 (18.7%) |       18,890 |
<script> attr. removed    |        92 (0.5%) |    4,448 (19.1%) |       18,798 |
<form> attr. removed      |         0 (0.0%) |    4,448 (19.1%) |       18,798 |
<input> attr. removed     |         0 (0.0%) |    4,448 (19.1%) |       18,798 |
Simple boolean attributes |         0 (0.0%) |    4,448 (19.1%) |       18,798 |
Simple doctype            |         0 (0.0%) |    4,448 (19.1%) |       18,798 |
Remove js pseudo-protocol |         0 (0.0%) |    4,448 (19.1%) |       18,798 |
Remove http protocol      |        30 (0.2%) |    4,478 (19.3%) |       18,768 |
Remove https protocol     |        48 (0.3%) |    4,526 (19.5%) |       18,720 |
Compress inline CSS (YUI) |       192 (1.0%) |    4,718 (20.3%) |       18,528 |
Compress JS (Closure)     |                - |                - |            - |
================================================================================

Each consecutive compressor setting is applied on top of previous ones.
In order to see JS and CSS compression results, YUI jar file must be present.
All sizes are in bytes.

Original issue reported on code.google.com by lord....@gmail.com on 16 Feb 2014 at 6:52

GoogleCodeExporter commented 9 years ago
This does not work for any optimization level of closure.

Original comment by lord....@gmail.com on 16 Feb 2014 at 6:55

GoogleCodeExporter commented 9 years ago
I tried to run this on two machines 

java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)

and 

java version "1.6.0_30"
OpenJDK Runtime Environment (IcedTea6 1.13.1) (amazon-66.1.13.1.62.amzn1-x86_64)
OpenJDK 64-Bit Server VM (build 23.25-b01, mixed mode)

Original comment by lord....@gmail.com on 16 Feb 2014 at 7:19