Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Use Sass

DZone's Guide to

Use Sass

·
Free Resource
Sass is a meta-language on top of CSS. 

Installation: Sass is part of Haml, which is available via git.  

gem install haml


Sass can be used with Ruby, Ruby on Rails or as a command-line tool.
To run Sass from the command line

sass input.sass output.css


Sample Usage (with variables)

// constants
!main_color = blue
!site_background = white 

body
  :color = !main_color
  :font 
    :family verdana, arial, sans-serif
    :size 12px


Sass can calculate 

!color2 = !main_color*0.33 + !site_background*0.67 
!color3 = !main_color*0.67 + !site_background*0.33 

#box
  :color = !color2
  :background_color = !color3


Remarks:
- Sass bzw. Haml Homepage: http://haml.hamptoncatlin.com/
- Sass and CSS cannot be mixed. Existing CSS has to be translated to Sass first. The commandline tool "css2sass" can help.


  
Topics:

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}