Module: Squoosh

Defined in:
lib/squoosh.rb,
lib/squoosh/version.rb

Overview

Minify HTML, JavaScript, and CSS.

Examples

html = <<-EOF
<!DOCTYPE html>
<html>
  <head>
    <!-- Set the title -->
    <title>My fancy title!</title>
  </head>
  <body>
    <p>Two</p>
    <p>paragraphs.</p>
  </body>
</html>
EOF
compressed = Squoosh.minify_html(html)
# "<!DOCTYPE html><title>My fancy title!</title><p>Two<p>paragraphs."

Author:

  • Stephen Checkoway <s@pahtak.org>

Defined Under Namespace

Classes: Squoosher

Constant Summary collapse

VERSION =

The version of squoosh.

'0.2.1'

Class Method Summary collapse

Class Method Details

.minify_css(content, options = {}) ⇒ String

Minify CSS convenience method.



593
594
595
# File 'lib/squoosh.rb', line 593

def self.minify_css(content, options = {})
  Squoosher.new(options).minify_css content
end

.minify_html(content, options = {}) ⇒ String

Minify HTML convenience method.



584
585
586
# File 'lib/squoosh.rb', line 584

def self.minify_html(content, options = {})
  Squoosher.new(options).minify_html content
end

.minify_js(content, options = {}) ⇒ String

Minify JavaScript convenience method.



602
603
604
# File 'lib/squoosh.rb', line 602

def self.minify_js(content, options = {})
  Squoosher.new(options).minify_js content
end