attach-css

1.1.0 • Public • Published

attach-css

Localizes CSS based on a virtual DOM tree.

build status NPM version experimental

Sauce Test Status

example

var attachCSS = require('attach-css')
var createElement = require('base-element')
 
var button = createElement(document.body)
var vtree = button.render(function () {
  return this.html('button', {
    className: 'my-button'
  }, 'click me')
})
 
var css = attachCSS('button { cursor: pointer; }', vtree)
// css will equal: button.my-button { cursor: pointer; }

api

attachCSS(src, vtree[, options])

  • src - A string of CSS to localize.
  • vtree - A virtual DOM tree to localize against.
  • options - Options to use when parsing/stringifying the CSS. See https://www.npmjs.com/package/css.

license

(c) 2015 Kyle Robinson Young. MIT License

Package Sidebar

Install

npm i attach-css

Weekly Downloads

34

Version

1.1.0

License

MIT

Last publish

Collaborators

  • shama