JSPM

load-styles

2.0.0
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 7955
    • Score
      100M100P100Q118275F
    • License MIT

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

    Package Exports

    • load-styles

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (load-styles) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    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