macray / htmlcompressor

Automatically exported from code.google.com/p/htmlcompressor
Apache License 2.0
0 stars 0 forks source link

false detection of inline scripts (to get tossed to YUI) #47

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. grab attached test.html
2. java -jar htmlcompressor-1.4.1.jar  --compress-js --preserve-php test.html 

What is the expected output? 

Minified HTML with the inline php in tact.

What do you see instead?

This error:

[ERROR] HtmlCompressor: "unterminated string literal" at line [1:30] during 
JavaScript compression: js/libs/modernizr-2.0.min.js">
[ERROR] HtmlCompressor: "syntax error" at line [1:30] during JavaScript 
compression: js/libs/modernizr-2.0.min.js">
[ERROR] HtmlCompressor: "Compilation produced 2 syntax errors." at line [1:0] 
during JavaScript compression
org.mozilla.javascript.EvaluatorException: Compilation produced 2 syntax errors.
    at com.googlecode.htmlcompressor.compressor.YuiJavaScriptCompressor$DefaultErrorReporter.runtimeError(YuiJavaScriptCompressor.java:93)
    at org.mozilla.javascript.Parser.parse(Parser.java:392)
    at org.mozilla.javascript.Parser.parse(Parser.java:337)
    at com.yahoo.platform.yui.compressor.JavaScriptCompressor.parse(JavaScriptCompressor.java:312)
    at com.yahoo.platform.yui.compressor.JavaScriptCompressor.<init>(JavaScriptCompressor.java:533)
    at com.googlecode.htmlcompressor.compressor.YuiJavaScriptCompressor.compress(YuiJavaScriptCompressor.java:53)
    at com.googlecode.htmlcompressor.compressor.HtmlCompressor.compressJavaScript(HtmlCompressor.java:837)
    at com.googlecode.htmlcompressor.compressor.HtmlCompressor.processScriptBlocks(HtmlCompressor.java:772)
    at com.googlecode.htmlcompressor.compressor.HtmlCompressor.processPreservedBlocks(HtmlCompressor.java:662)
    at com.googlecode.htmlcompressor.compressor.HtmlCompressor.compress(HtmlCompressor.java:193)
    at com.googlecode.htmlcompressor.CmdLineCompressor.main(CmdLineCompressor.java:349)

Thanks! Really like the new statistics stuff.

Original issue reported on code.google.com by paul.ir...@gmail.com on 31 Jul 2011 at 1:37

Attachments:

GoogleCodeExporter commented 9 years ago
Fixed in 1.4.2, but at a (small) price. One space around custom preservation 
blocks won't be collapsible when "remove intertag spaces" option is on, so for 
example:

<a>   <?php ?>       <c>   <d>

will be compressed to:

<a> <?php ?> <c><d>

Thanks.

Original comment by serg472@gmail.com on 31 Jul 2011 at 2:47

GoogleCodeExporter commented 9 years ago
Huge. You are a machine. :)

Thx man!

Original comment by paul.ir...@gmail.com on 31 Jul 2011 at 3:10

GoogleCodeExporter commented 9 years ago
Here was the downstream issue, fwiw: 
https://github.com/paulirish/html5-boilerplate/issues/608

Original comment by paul.ir...@gmail.com on 31 Jul 2011 at 3:14