A Rollup plugin for compiling .scss, .sass, and .css files into a single CSS file, with support for source maps, custom processors (e.g., PostCSS), and prefix injection. Version 4.0.1 is stable and actively maintained. It automatically uses the 'sass' package over 'node-sass', is written in TypeScript, and integrates seamlessly with Rollup's asset pipeline. Compared to alternatives like rollup-plugin-postcss, it focuses solely on Sass/SCSS compilation without additional CSS processing by default, offering a leaner setup for pure SCSS projects.
npm install rollup-plugin-scssVerified import paths — ran on the pinned version, not inferred.
Example Rollup config using rollup-plugin-scss with options: custom output filename, source maps, include/exclude patterns, error handling, and output callback.
Add 'sass' (or 'node-sass') to your devDependencies: npm install --save-dev sass
Use dynamic import if needed: const scss = (await import('rollup-plugin-scss')).default;Update callback: function(styles, styleNodes) where styleNodes is Array<{filename: string, content: string}>Use 'fileName' instead of 'name' to set the output CSS filename.
Explicitly set the 'sass' option to the compiler you want: sass: require('node-sass')Install: npm install --save-dev rollup-plugin-scss. For CJS, use dynamic import: const scss = (await import('rollup-plugin-scss')).default;Use default import: import scss from 'rollup-plugin-scss'
Set 'output' to a callback function or false: output: (styles, styleNodes) => { ... }Install sass or node-sass: npm install --save-dev sass