Skip to content

Instantly share code, notes, and snippets.

@bobthecow
Forked from dutygeeks/html_compressor.rb
Created February 29, 2012 22:36
Show Gist options
  • Save bobthecow/1945051 to your computer and use it in GitHub Desktop.
Save bobthecow/1945051 to your computer and use it in GitHub Desktop.
HTML COMPRESSOR
require 'html_compressor'
class HtmlCompressor < Nanoc3::Filter
identifier :html_compressor
# Runs the content through htmlcompressor.
#
# This method optionally takes options to pass directly to htmlcompressor
#
# @param [String] content The content to filter
#
# @param [Hash] params Options passed to htmlcompressor
#
# @return [String] The filtered content
def run(content, params={})
compressor = HtmlCompressor::HtmlCompressor.new(params)
compressor.compress(content)
end
end
@bobthecow
Copy link
Author

Options are:

:charset => 'utf-8',
:line_break => nil,
:java => '/path/to/java'
:munge => false,
:optimize => true,
:preserve_semicolons => false,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment