Project

html_mini

0.01
No commit activity in last 3 years
No release in over 3 years
Simple, fast HTML minification for Rack applications
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 1.4.0
 Project Readme

HtmlMini

The html_mini gem includes a simple module and a middleware that adds HTML minification for Rack applications. HtmlMini is optimised for speed over syntax preservation.

Disclaimer

This is an early release that has not been tested in production. I wanted to try out creating a rack middleware and a gem. The minify logic is minimal therefore unexpected issues can occur. Use at your own risk

If you have inline Javascript in your Html, make sure all lines are ended by semi colons, and that you only use multi or full line comments, no comments at end of line.

Using with Rack application

HtmlMini can be used with any Rack application, for example with a Sinatra application. If your application includes a rackup file or uses Rack::Builder to construct the application pipeline, simply require and use as follows:

require 'rack/minify'
use Rack::Minify
run app

Using with Rails 3

In order to use, include the following in a Rails application Gemfile file:

gem 'html_mini'

config/application.rb file:

require 'rack/minify'
config.middleware.insert_before Rack::ETag, Rack::Minify

Check the Rack configuration:

rake middleware

Credits

Author

Jerome Touffe-Blin, @jtblin, http://www.linkedin.com/in/jtblin

License

HtmlMini is copyright 2012 Jerome Touffe-Blin and contributors. It is licensed under the BSD license. See the include LICENSE file for details.