objss
Converts JavaScript style objects into CSS-like strings
Last updated 10 years ago by jxnblk .
MIT · Original npm · Tarball · package.json
$ npm install objss 
SYNC missed versions from official npm registry.

objss

Converts JavaScript style objects into CSS-like strings.

npm i objss
const objss = require('objss')

const css = objss({
  margin: 16,
  color: 'tomato'
})
// 'margin:16px;color:tomato;'

const css = objss({
  color: 'tomato',
  ':hover': {
    color: 'green'
  }
})
// 'color:tomato;&:hover{color:green;}'

What is this for?

Sometimes CSS-in-JS solutions require tagged template literals.

JavaScript object literals are often easier to work with.

This can be used in place of tagged template literals.

foo([objss({ color: 'tomato' })])
// The same as foo`color:tomato;`

There might be other use-cases as well.

Related:

The reverse of this:

css-to-object

MIT License

Current Tags

  • 1.0.3                                ...           latest (10 years ago)

5 Versions

  • 1.0.3                                ...           10 years ago
  • 1.0.2                                ...           10 years ago
  • 1.0.1                                ...           10 years ago
  • 1.0.0                                ...           10 years ago
  • 1.0.0-1                                ...           10 years ago
Maintainers (1)
Downloads
Total 20
Today 0
This Week 0
This Month 15
Last Day 0
Last Week 0
Last Month 5
Dependencies (1)
Dev Dependencies (1)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE