Socket
Socket
Sign inDemoInstall

coss

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    coss

A simple compiler that compiles js to css.


Version published
Weekly downloads
9
increased by800%
Maintainers
1
Install size
8.32 kB
Created
Weekly downloads
 

Readme

Source

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
}

Keywords

FAQs

Last updated on 15 Oct 2014

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc