Project

html_press

0.03
No commit activity in last 3 years
No release in over 3 years
Ruby gem for compressing html
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
>= 0

Runtime

>= 0.1.0
>= 0.1.0
 Project Readme

HtmlPress Gem Version Build Status Dependency Status Code Climate

How it works

Remove all whitespace junk. Leave only HTML

1.               ┌――――――――――――――――――╖        2.         ┌――――――――――――――――――╖
  ●――――――――――――――├―╢ <html> ws junk ║          ●――――――――├―――――――――╢ <html> ║
                 └――――――――――――――――――╜                   └――――――――――――――――――╜

Usage

Ruby

require 'html_press'
compressed_html = HtmlPress.press html

Jekyll

see jekyll_press

Rails

TODO ❗

Sinatra

TODO ❗

Command line

TODO ❗

TODO

  • use parser () instead of regexp's
    • add option to convert relative urls to absolute urls (for SEO)
  • ambigious ampersands for compression?
  • Support other js/css minifiers (Closure, YUI compressor)
  • htmlTydi
  • Rack plugin
  • add script to benchmark real projects like amazon or stackoverflow
  • support html5 tags
  • add more options
  • Optimization: make substring replace based on substring length and its position in initial string

Alternatives

Additional tools

  • jeanny - rename css classes and ids in css and html files
    • make shorter pathes for images in css
  • deadweight - remove unused css rules from css files
  • csscss will parse any CSS files you give it and let you know which rulesets have duplicated declarations.
  • css-spriter, sprite-factory - combine images in sprites
  • resize images by size defined in html and vice versa embed size of images in html
  • #1, #2 - inline small images in css
  • smusher, jpegtran, optipng - losslessly minify images
  • sprockets, jammit - asset bundlers
  • w3c_validators
  • reduce

Resources

Minimize HTML

Front-end optimization