Skip to content

insert a string of css into the <head>

License

Notifications You must be signed in to change notification settings

bcomnes/insert-css2

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NPM version

insert-css2

insert a string of css into the <head>. Maintenance fork.

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

About

insert a string of css into the <head>

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%