0.0.5 • Published 10 years ago

coss v0.0.5

Weekly downloads
2
License
MIT
Repository
github
Last release
10 years ago

COSS

npm install coss

# Or use in browser. Note that only the `coss.min.js` is build for browser.
bower install coss

API

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
}
0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago