paolochiodi / htmlcompressor

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

Options for HTTP(S) protocol removing #1

Closed mikian closed 6 years ago

mikian commented 12 years ago

Added functionality to specify which attributes are cleaned from HTTP(S) protocols. I use lazyloading javascript library which uses special data-original attribute to store original image path. This needs also to be included in the list of attributes where protocol can be removed without problems. Modified code that if @opions[:remove_http_protocol] is true, old functionality works as always. If it is comma-separated list of attributes, those are used instead of predefined Regexp.

E.g.

@compressor = HtmlCompressor::Compressor.new({
    :remove_http_protocol => "href,src,cite,action,data-original,data-hires"
})