JSPM

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

insert a string of css into the <head>

Package Exports

  • insert-css

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 (insert-css) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

insert-css

insert a string of css into the <head>

browser support

example

    var insertCss = require('insert-css');
    var styleElement = insertCss('body { background:blue; }');

api

    var insertCss = require('insert-css');

var styleElement = insertCss(css, opts);

Insert some CSS into the page.

  • opts.container - Which HTMLElement to use as the base mounting point, defaults to document.querySelector('head').

  • opts.prepend - Add the CSS at the top level of the container instead of at the bottom level (default).

This is particullary useful for library creators where you may want your default CSS to be prepended so it can be easily overriden by user styles.

development

example

npm run example

test

npm test