1.0.3 • Published 2 years ago
rollup-plugin-cssimport v1.0.3
rollup-plugin-cssimport
Please consider migrating to rollup-plugin-import-assert, as it better aligns with modern web standards.
Very simple rollup plugin to transform .css-files into CSSStyleSheet objects.
This works natively in chrome. Firefox and other browsers require a Polyfill (like https://github.com/calebdwilliams/construct-style-sheets)
Examples
Global styles
import MyDocumentStyle from './myDocumentStyle.css';
document.adoptedStyleSheets = [MyDocumentStyle];
Element styles
import MyElementStyle from './myElementStyle.css';
class MyElement extends HTMLElement {
constructor() {
super();
this.attachShadow({mode: 'open'});
this.adoptedStyleSheets = [MyElementStyle];
}
}