Skip to content
This repository has been archived by the owner on Jul 4, 2019. It is now read-only.

jxnblk/objss

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages