A Rollup plugin that enables seamless CSS processing via PostCSS, supporting CSS modules, custom preprocessors (Sass, Stylus, Less), and automatic extraction or injection of styles. v1.0.0 is the current stable version with a well-documented API and active maintenance from egoist. Key differentiators include built-in support for PostCSS config files, auto CSS modules for .module.* files, and a simple plugin interface that integrates deeply with Rollup's build pipeline. Alternatives like rollup-plugin-css-only offer lighter but less feature-rich integration.
npm install rollup-plugin-postcss2Verified import paths — ran on the pinned version, not inferred.
Basic rollup.config.js setup with PostCSS plugin including autoprefixer, minification, CSS extraction, and CSS modules.
Update config: if modules: {} was used, it's still valid; if modules: true was used, it's still valid.Set extract: true to avoid injection and get a CSS file instead, or use inject: false to prevent injection but still get the string.
Set config: false in plugin options to disable automatic config loading.
Replace namedExports: true with namedExports: (name) => name.replace(/-/g, '_') or similar.
Use @import '~bootstrap/dist/css/bootstrap'; and install bootstrap as a dependency.
Ensure postcss is added to plugins in rollup.config.js and that the CSS file extension is in the plugin's extensions list (default includes .css).
Run 'npm install postcss --save-dev' or 'yarn add postcss --dev'.
Use 'import postcss from 'rollup-plugin-postcss'' then call 'postcss({...})' as a function.