inject-inline-style

2.0.0 • Public • Published

inject-inline-style

NPM version License

Inject an object as an inline CSS string.

Installation

npm install inject-inline-style

Usage

var injectStyle = require('inject-inline-style')
 
var style = injectStyle({
  '.button': {
    color: 'red'
  },
  '.button:hover': {
    color: 'blue'
  }
})
 
console.log(style) // => ".button{color:red}.button:hover{color:blue}"

Which injects the following into the HTML document's <head>:

<style type="text/css">.button{color:red}.button:hover{color:blue}</style> 

See also

License

MIT

Package Sidebar

Install

npm i inject-inline-style

Weekly Downloads

3

Version

2.0.0

License

MIT

Last publish

Collaborators

  • gummesson