yo-css

1.1.0 • Public • Published

yo-css

yo-yo helper for inline css, inspired by React: CSS in JS by vjeux.

Example

const css = require('yo-css')
const yo = require('yo-yo')
 
const style = {
  backgroundColor: 'red',
  width: 0,
  border: '3px'  
}
 
const overwrite = {
  backgroundColor: 'green'  
}
 
const el = yo`
  <div style=${css(style, overwrite)}>
    Test!
  </div>
`
 
document.body.appendChild(el)

Installation

$ npm install yo-css

API

css(...styles)

Given any number of style objects, merges them into one and returns a valid string of css. Later style objects have precedence. Use camelCase for your properties, this function converts them into proper css case.

License

MIT

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.1.0
    5
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.1.0
    5
  • 1.0.1
    1
  • 1.0.0
    0

Package Sidebar

Install

npm i yo-css

Weekly Downloads

3

Version

1.1.0

License

MIT

Last publish

Collaborators

  • juliangruber