Method: MultiHtml.min

Defined in:
lib/multi_html.rb

.min(string, options = {}) ⇒ Object

Minify HTML



100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/multi_html.rb', line 100

def min(string, options={})
  string = string.read if string.respond_to?(:read)

  adapter = current_adapter(options)
  if defined?(adapter::ParseError)
    begin
      adapter.min(string, options)
    rescue adapter::ParseError => exception
      raise ::MultiHtml::ParseError.new(exception.message, exception.backtrace)
    end
  else
    adapter.min(string, options)
  end
end