module SquashWhitespace

Constants

VERSION

Public Class Methods

squash_html(html, options = {}) click to toggle source
# File lib/squash_whitespace.rb, line 3
def squash_html(html, options = {})
  html = html.gsub(/\A\s+|\s+\Z/, '').gsub(/>\s+</, '><').gsub(/^\s+</, '<')
  html = html.gsub(/>\s*(.*?)\s*</, '>\1<') if options[:strip]
  html
end