A rollup plugin for loading css files as CSSStyleSheet
s.
Add the registry to .npmrc
:
@alorel:registry=https://npm.pkg.github.com
Then install it:
npm install @alorel/rollup-plugin-constructable-css
All options are standard rollup plugin options.
interface ConstructableCssRollupPluginOpts {
exclude?: FilterPattern;
include: FilterPattern;
/** @default false */
preferConst?: boolean;
/** @default true */
sourceMap?: boolean;
}
import {constructableCssRollupPlugin} from '@alorel/rollup-plugin-constructable-css';
export default {
// ...
plugins: [
constructableCssRollupPlugin({
include: /\.constructed\.css/
})
]
}
body{color:red};
var stylesheet = new CSSStyleSheet();
stylesheet.replaceSync("body{color:red};");
export default stylesheet;