Module: HTML5

Defined in:
lib/h5-min.rb,
lib/h5-min/optional.rb

Defined Under Namespace

Modules: OptionalTags

Constant Summary collapse

PRE_TAGS =

Elements in which whitespace is significant, so can’t be normalised

[:pre, :style, :script, :textarea]
FLOW_ELEMENTS =

Elements representing flow content

%w{a abbr address area article aside audio b bdo blockquote br 
 button canvas cite code command datalist del details dfn div 
 dl em embed fieldset figure footer form h1 h2 h3 h4 h5 h6 header 
 hgroup hr i iframe img input ins kbd keygen label link
 map mark math menu meta meter nav noscript object ol output 
 p pre progress q ruby samp script section select small span 
 strong style sub sup svg table textarea time ul var video wbr
}.map(&:to_sym)

Class Method Summary collapse

Class Method Details

.minify(html) ⇒ Object



124
125
126
127
128
# File 'lib/h5-min.rb', line 124

def self.minify html
  minifier = @minifier.new
  Nokogiri::HTML::SAX::Parser.new(minifier).parse(html)
  OptionalTags.remove minifier.buf.strip
end