Introduction
Compass is a CSS Authoring Framework with a lot of reusable patterns. Developers spend less time on browser prefixes, css2 opacity, browser checking, IE hacks, reset stylesheets and so on...
Installation:
1 | gem install compass |
1 | compass create myproject |
1 | compass watch myproject |
Pattern usage
In order to find out available constructs in the framework use compass documentation
Before using any compass patterns, we have to declare them:
1 | @import "compass/css3/border-radius" ; |
1 | @import "compass/css3" ; |
1 2 3 | .box { @include border-radius( 5px ); } |
1 2 3 4 5 6 | /* line 8, ../sass/screen.scss */ #elem { -webkit-box-shadow: red , 2px , 5px , 10px ; -moz-box-shadow: red , 2px , 5px , 10px ; box-shadow: red , 2px , 5px , 10px ; } |
Best practice
Best practice is to make base.scss with includes, global variables and pattern variable overrides:
1 2 3 4 5 | @import "compass/reset" ; @import "compass/css3" ; @import "compass/utilities" ; $default-box-shadow- color : red ; |
Import the base.scss in the custom scss files:
1 2 3 4 5 6 7 8 9 | @import 'base' ; .box { @include border-radius( 5px ); } #myelemid { @include box-shadow( blue , 1px , 3px , 5px ); } |
compass and 960
Installation:
1 | gem install compass-960-plugin |
1 | compass create -r ninesixty my_project960 --using 960 |
http://compass-style.org/
@msvaljek
No comments:
Post a Comment