Skip to content

Commit

Permalink
Document the compression behaviors in the readme.
Browse files Browse the repository at this point in the history
  • Loading branch information
rstacruz committed Sep 3, 2012
1 parent c18bc34 commit 0e8fa5e
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 10 deletions.
38 changes: 28 additions & 10 deletions README.md
Expand Up @@ -50,24 +50,42 @@ Some identifiers, like pixel values or colors, can be trimmed to save on space.


``` css ``` css
div { color: #ff0000; } div { color: #ff0000; }
span { margin: 0px !important; } span { margin: 1px !important; }
h1 { background: none; } h1 { background: none; }
a { padding: 0.30em; } a { padding: 0.30em; }
p { font-family: "Lucida Grande", sans-serif; } p { font-family: "Arial Black", sans-serif; }
abbr { background: url("tile.jpg"); } abbr { background: url("tile.jpg"); }
ul { padding: 30px 30px 30px 30px; }
``` ```


Can be: (newlines added for readability) Can be: (newlines added for readability)


``` css ``` css
div{color:#f00} div{color:#f00} /* Collapsing 6-digit hex colors to 3 */
span{margin:0!important} span{margin:1px!important} /* Strip space before !important */
h1{background:0} h1{background:0} /* Change border/background/outline 'none' to '0' */
a{padding:.3em} a{padding:.3em} /* Removing trailing zeroes from numbers */
p{font-family: Lucida Grande,sans-serif} p{font-family: Arial Black,sans-serif} /* Font family unquoting */
abbr{background:url(tile.jpg)} abbr{background:url(tile.jpg)} /* URL unquoting */
ul{padding:30px} ```

#### More compressions

``` css
ul { padding: 30px 30px 30px 30px; }
li { margin: 0 auto 0 auto; }
.zero { outline: 0px; }
a + .b { color: blue; }
.color { background: rgb(51,51,51); }
```

Output:

``` css
ul{padding:30px} /* Collapsing border/padding values */
li{margin:0 auto} /* Same as above */,
.zero{outline:0} /* Removing units from zeros */
a+.b{color:blue} /* Collapse + and > in selectors */
.color{background:#333} /* Converting rgb() values to hex */
``` ```


#### Selector/declaration sorting #### Selector/declaration sorting
Expand Down
8 changes: 8 additions & 0 deletions TODO.md
Expand Up @@ -3,4 +3,12 @@ Todo


* Remove duplicate keyframes * Remove duplicate keyframes
* Remove duplicate font faces * Remove duplicate font faces
* `[type="submit"]` to `[type=submit]`
* `black` to `#000`
* `#f00` to `red`, `#d2b48c` to `tan`
* `*.foo` to `.foo`

'#f00': 'red'
'#d2b48c': 'tan'
'#fffafa': 'snow'


0 comments on commit 0e8fa5e

Please sign in to comment.