Examples
This section contains example projects demonstrating how to use rollup-plugin-require-css.
Online Examples
Try the plugin online with StackBlitz or CodeSandbox:
| Example | Description | Link |
|---|---|---|
| Basic | Basic CSS import and bundling | StackBlitz |
| CSS Modules | Scoped CSS with CSS Modules | StackBlitz |
| Preprocessors | Sass, Less, and Stylus | StackBlitz |
| PostCSS | PostCSS with autoprefixer | StackBlitz |
| Code Splitting | Split CSS by entry | StackBlitz |
| Shadow DOM | Constructable stylesheets | StackBlitz |
Local Examples
Clone the repository and try the examples locally:
bash
git clone https://github.com/saqqdy/rollup-plugin-require-css.git
cd rollup-plugin-require-css/examples/basic
pnpm install
pnpm run build
cat dist/style.cssFeature Coverage
| Feature | basic | css-modules | preprocessors | postcss | code-splitting | shadow-dom |
|---|---|---|---|---|---|---|
| CSS import | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| CSS Modules | - | ✓ | ✓ | - | - | - |
| Sass/SCSS | - | - | ✓ | - | - | - |
| Less | - | - | ✓ | - | - | - |
| Stylus | - | - | ✓ | - | - | - |
| PostCSS | - | - | - | ✓ | - | - |
| Code splitting | - | - | - | - | ✓ | - |
| Shadow DOM | - | - | - | - | - | ✓ |
| Source maps | ✓ | ✓ | ✓ | ✓ | ✓ | - |
| Minification | ✓ | ✓ | - | - | - | - |