load-styles
Add a CSS <style> tag to the document's <head> node
Last updated 12 years ago by tootallnate .
MIT · Original npm · Tarball · package.json
$ npm install load-styles 
SYNC missed versions from official npm registry.

load-styles

Add a CSS <style> tag to the document's <head> node.

Installation

$ npm install load-styles

API

loadStyles(String cssStr[, Document doc]) → <style>

Creates a <style> DOM node with the specified cssStr text injected into it. Then, the <style> node is inserted into the <head> element of the doc document instance. Finally, the DOM node is returned back to the user in case any further action is required on the node.

Example

<div id="foo">This div should be red.</div>
var loadStyles = require('load-styles');
loadStyles(
  '#foo {' +
  '  width: 100px;' +
  '  height: 100px;' +
  '  background-color: red;' +
  '  text-align: center;' +
  '  font-size: 9px;' +
  '}'
);

License

MIT

Current Tags

  • 2.0.0                                ...           latest (12 years ago)

2 Versions

  • 2.0.0                                ...           12 years ago
  • 1.0.1                                ...           13 years ago
Maintainers (1)
Downloads
Total 8
Today 0
This Week 0
This Month 2
Last Day 0
Last Week 0
Last Month 1
Dependencies (0)
None
Dev Dependencies (0)
None

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