🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

load-styles

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

load-styles

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

2.0.0
latest
npm
Version published
Weekly downloads
7.2K
-17.6%
Maintainers
1
Weekly downloads
 
Created
Source

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

Keywords

css

FAQs

Package last updated on 03 Dec 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts