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

Add syntax to mark HTML blocks that should be preserved #35

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Currently you can define as many preservation rules as you like, but it 
requires a bit of extra work. 

I am thinking a good addition would be to create some simple syntax that would 
tell HTML compressor to skip following block. Currently I am leaning towards:

<!-- {{{ --> 
     - Anything inside will be preserved, with the highest priority after user defined blocks
     - Number of spaces around {{{ could be zero or more
     - These comments themselves will be always removed ignoring comment removal setting
<!-- }}} -->

Making it an HTML comment would ensure that having it on a page wouldn't break 
anything even if HTML compressor is not applied to the page.

Now a few questions for you:
- What do you think about such syntax? Could it interfere with any other 
scripting language?
- Should this syntax have the higher priority over user defined rules or not? I 
think user defined rules still should be at the top as if you went through the 
trouble of defining them then you should know what you are doing.
- Should these comments be treated as regular comments during compression and 
removed with the rest of the comments if set so, or always removed?

Original issue reported on code.google.com by serg472@gmail.com on 10 Apr 2011 at 4:56

GoogleCodeExporter commented 9 years ago
Implemented in 1.2 release

Original comment by serg472@gmail.com on 30 Apr 2011 at 6:50