append-css
v1.1.2
Published
Add css rule to document.
Downloads
34
Readme
append-css
Append css rule to document.
This is wrapper for <style></style>
element.
<script src="./browser/build.js"></script>
<script>
const AppendCss = require('append-css');
// append new rule
let appendedRules = new AppendCss(`
body {
background: black;
}
`);
// disable rules
appendedRules.disable();
// change rules
appendedRules.textContent = `
body {
width: 100%;
}
`;
// enable rules
appendedRules.enable();
// dispose appended rules and <style></style> element
appendedRules.dispose();
</script>
options
constructor(cssText, options);
prepend
Append <style></style>
element to before document.head.firstChild
.
{ prepend: true }