paolochiodi / htmlcompressor

A work in progress port of google's htmlcompressor.jar
Other
150 stars 26 forks source link

add support for custom javascript html template #22

Closed dfguo closed 9 years ago

dfguo commented 9 years ago

allow custom defined javascript html templates to be compressed. Similar to this request https://code.google.com/p/htmlcompressor/issues/detail?id=78

dfguo commented 9 years ago

any news on this? @paolochiodi

paolochiodi commented 9 years ago

Hi, sorry for the delay. I've been out for holidays and still catching up with mails. The pull-request is simple enough and looks good. I'll work on it later today, but there are two things that make me think:

  1. the name of the option is a bit long, I'll see if I came up with something shorter but still clear
  2. (not directly tied to your request, but still relevant): compressing templates is error prone and may cause problems
    e.g.: <p class="{{value}}"> under certain conditions may be rewritten as <p class={{value}}> (without quotes) causing problems if the template engine happen to replace value with two space-separated classes. At the moment I've no idea how to solve this, at a minimum I'll put a warning in the README
dfguo commented 9 years ago

Thanks for the reply. I realized that problem too so I turned off remove_quotes option in my own application settings. Perhaps the warning could suggest that.

dfguo commented 9 years ago

any updates on this?

paolochiodi commented 9 years ago

@dfguo sorry for taking so long. I decided to go with a slightly different implementations, now published as version 0.2.0.

See here https://github.com/paolochiodi/htmlcompressor#javascript-template-compression for the new compress_js_templatesoption.

dfguo commented 9 years ago

sounds good. thanks!