Registry / web-framework / rollup-plugin-styler

rollup-plugin-styler

JSON →
library2.0.0jsnpmunverified

Universal Rollup plugin for processing CSS, PostCSS, Sass, Less, Stylus, and CSS Modules with asset handling and URL resolving. Current stable version is 2.0.0 (released 2025-02-09), with a new major version that resets stylus dependency. Key differentiators: supports multiple preprocessors, CSS Modules type exports, inject/extract/emit modes, and automatic PostCSS config loading. Actively maintained, with recent updates focusing on dependency upgrades and CI improvements.

npm install rollup-plugin-styler
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-STYL
R
rollup-plugin-styler
web-frameworkjavascriptv2.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import styles from 'rollup-plugin-styler'
const styles = require('rollup-plugin-styler')
ESM-only, CommonJS require not supported
RollupPluginStylerOptions
import type { RollupPluginStylerOptions } from 'rollup-plugin-styler'
import { RollupPluginStylerOptions } from 'rollup-plugin-styler'
Type import only, not a runtime object
InjectOptions
import type { InjectOptions } from 'rollup-plugin-styler'
Available in v2.0.0 for configuring CSS injection

Rollup config with rollup-plugin-styler in extract mode with Sass support.

import styles from 'rollup-plugin-styler'; export default { input: 'src/index.js', output: { dir: 'dist', format: 'esm', assetFileNames: '[name]-[hash][extname]' }, plugins: [ styles({ mode: 'extract', sass: { indentedSyntax: true } }) ] };
Debug
Known issues
breakingv2.0.0 resets stylus version, potentially breaking if relying on older stylus features
fix
Update stylus usage to match the new version.
affects: >=2.0.0
breakingThe package was renamed from 'rollup-styles' to 'rollup-plugin-styler' in v1.6.0; imports from the old name will fail
fix
Use 'rollup-plugin-styler' instead of 'rollup-styles'.
affects: >=1.6.0
deprecatedMode 'emit' may be removed in future versions; consider using 'inject' or 'extract'
fix
Switch to 'inject' or 'extract' mode.
affects: <2.0.0
gotchaDefault mode is 'inject', which embeds CSS in JS. Use 'extract' mode to output separate CSS files
fix
Set mode: 'extract' in plugin options.
affects: >=1.0.0
gotchaWhen using CSS Modules, import { css } instead of default export; default export returns a style object for injection
fix
Use `import { css } from './style.css'` for CSS string.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'rollup-styles'
Package renamed to rollup-plugin-styler
fix
npm install -D rollup-plugin-styler and update imports.
Error: Cannot find module 'postcss'
PostCSS is required when using PostCSS features
fix
npm install -D postcss
TypeError: styles is not a function
CommonJS require used instead of ESM import
fix
Use `import styles from 'rollup-plugin-styler'` instead of `require`.
Upgrade
Version history
2.0.0latest on npm
Audit
Dependencies
rolluprequiredpeer dependency, required for plugin to work
Agent activity
10 hits · last 30 days
node
8
Resources
rollup-plugin-styler — npm install rollup-plugin-styler · libregistry