README.md in csso-rails-0.0.1 vs README.md in csso-rails-0.0.2
- old
+ new
@@ -1,38 +1,61 @@
-csso-rails: Stylesheet Optimizer(CSSO) for Rails Asset pipeline
-=======
+# csso-rails: Stylesheet Optimizer (CSSO) for Rails Asset pipeline
-Ruby adapter for <https://github.com/afelix/csso>
+Ruby adapter for [github.com/afelix/csso](https://github.com/afelix/csso).
-about
------
- CSSO does structure-optimization for css.
- (readme and tests/comparison - coming later)
- Css is usually reduced more that in half in uncompressed and around 15% in gzipped.
+## About
+CSSO does structure-optimization for CSS.
+CSS is usually reduced more than in half in uncompressed and around 15% in gzipped.
-usage
-------
+### A Real-World Example
+A living rails application CSS – some written in less, some handwritten):
-From ruby:
- require 'csso'
- Csso.optimize("a{ color: #FF0000; }")
- # produces "a{color:red}"
+| | Original | sass | yui 2.4.7 | csso | % of original
+|:-------|:------------:|:------:|:-----:|:-----:|:------:
+|Plain | 129497 | 107006 | 60758 | 60874 | 47%
+|GZipped | 14046 | 12047 | 10558 | 10472 | 74%
-In Rails 3.1+:
- add this gem to your gemfile, and that's it!
- gem 'csso-rails', :git => ''
- Upon including it becomes the default compressor,
- More explicit way - set in config: config.assets.css_compressor = :csso
+Very close to yui compressor, wining in gzipped (you’re using nginx `mod\_gzip_static`, don’t you?)
-In command line:
- ruby_csso non_optimized.css > optimized.css
+A more hard example – twitter bootstrap.css, already minified:
+| | Original | lessc | yui 2.4.7 | csso | % of original
+|:-------|:------------:|:-----:|:-----:|:-----:|:------:
+|Plain | 81443 | 71520 | 68755 | 67679 | 83%
+|GZipped | 12384 | 11633 | 11652 | 11477 | 92%
-MIT-License
--------
+Please note than benchmark was taken in summer of 2012, since then things may have changed.
-> Original CSSO code - Copyright (C) 2011 by Sergey Kryzhanovsky
+## Usage
+
+### In Rails 3.1+
+add `gem 'csso-rails'` to your gemfile, and that’s it!
+
+Upon including it becomes the default compressor even if sass is included too.
+More explicit way – set in config: `config.assets.css_compressor = :csso`.
+
+
+### In Plain Ruby
+
+```ruby
+ require 'rubygems'
+ gem 'csso-rails'
+ require 'csso'
+ puts Csso.optimize("a{ color: #FF0000; }") # produces "a{color:red}"
+```
+
+In _maniac mode_(`Csso.optimize(css, true)`, default for pipeline) CSS is processed several times until it stops getting lighter (there're cases when original csso does not do all optimizations for no reason).
+
+### In Command Line
+
+ ruby_csso non_optimized.css > optimized.css
+
+
+## MIT-License
+
+> Original CSSO code - Copyright (C) 2011 by Sergey Kryzhanovsky.
+>
> ruby gem - Copyright(C) 2012 Vasily Fedoseyev
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
@@ -47,6 +70,6 @@
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
\ No newline at end of file
+THE SOFTWARE.