rollup-plugin-react-scoped-css
Version:
A rollup plugin designed to allow scoped css to be run in react (Compatible with vite and rollup)
51 lines (50 loc) • 1.61 kB
TypeScript
import { FilterPattern } from "@rollup/pluginutils";
import type { Plugin } from "rollup";
export interface ReactScopedCssPluginOptions {
/**
* Which files should be included and parsed by the plugin
* Default: undefined
*/
include?: FilterPattern;
/**
* Which files should be exluded and that should not be parsed by the plugin
* Default: undefined
*/
exclude?: FilterPattern;
/**
* If you want regular files to be scoped & global files to be .global.css
* Default: false
*/
scopeStyleByDefault?: boolean;
/**
* If you want to customize the pattern for scoped styles.
* This will only work if scopeStyleByDefault is false
* Default: 'scoped'
*/
scopedStyleSuffix?: string;
/**
* If you want to customize the pattern for global styles.
* This will only work if scopeStyleByDefault is true
* Default: 'global'
*/
globalStyleSuffix?: string;
/**
* If you want to customize the pattern for style files.
* Default: ['css', 'scss', 'sass', 'less']
*/
styleFileExtensions?: string[];
/**
* If you want to customize the pattern for jsx files.
* Default: ['jsx', 'tsx']
*/
jsxFileExtensions?: string[];
/**
* If you want to customize the attribute prefix that is added to the jsx elements
* Default: undefined
*/
hashPrefix?: string;
}
export interface VitePartialPlugin extends Plugin {
enforce?: "pre" | "post";
}
export declare function reactScopedCssPlugin(optionsIn?: ReactScopedCssPluginOptions): VitePartialPlugin[];