npm install coss
# Or use in bower.
bower install coss
param: source
{ Object | Array }
The source data to compile.
param: indent
{ String }
Default is 4 spaces.
return: { String }
The compiled code.
example:
level = ->
level.count ?= 1
'.level_' + level.count++
# Compile an array css tree.
# The array compiler can use variable as css selector.
coss [
['#basic'
['font-size', '12px']
['opacity', 0.8]
]
[level()
['background', 'red']
['border', '1px solid #fff']
['&:hover'
['background', 'blue']
]
[level()
['margin', '1px']
[level()
['padding', 0]
]
]
]
]
# Compile an object css tree.
coss {
'.level_1':
background: 'red'
border: '1px solid #fff'
'.level_2':
margin: '1px'
'.level_3':
padding: 0
'#another':
'font-size': '12px'
opacity: 0.8
}