Registry / rollup-plugin-stylus-compiler

rollup-plugin-stylus-compiler

JSON →
library1.0.1jsnpmunverified

A Rollup plugin (version 1.0.1, released Oct 2019) that compiles .styl/.stylus files to CSS using the Stylus preprocessor. It does not handle CSS output directly; instead, it must be paired with another plugin (e.g., rollup-plugin-css-porter, rollup-plugin-css-only, or rollup-plugin-postcss) to emit or inline the resulting CSS. The plugin is minimal, focusing solely on Stylus compilation, and relies on Stylus as a peer dependency. Compared to rollup-plugin-postcss (which supports multiple preprocessors), this plugin is Stylus-specific and lighter. Last updated in 2019, it is considered maintenance-only.

npm install rollup-plugin-stylus-compiler
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-STYL
R
rollup-plugin-stylus-compiler
javascriptv1.0.1
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
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 18–223 runs
build_error
glibc
node 18–223 runs
build_error
Code
Verified usage

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

default import (stylus function)
✓ import stylus from 'rollup-plugin-stylus-compiler'
✗ const stylus = require('rollup-plugin-stylus-compiler')
CommonJS require works but is not recommended for future-proofing. The package has no named exports.
Plugin invocation
✓ plugins: [stylus()]
✗ plugins: [stylus]
The default export is a factory function; it must be called with optional options (e.g., stylus({ compress: true })).
Using with rollup-plugin-css-porter
✓ import stylus from 'rollup-plugin-stylus-compiler'; import css from 'rollup-plugin-css-porter'; export default { plugins: [stylus(), css()] }
Order matters: stylus() must come before CSS output plugins.

Shows minimal setup with rollup-plugin-css-porter to compile .styl and output CSS files.

// Install: npm install --save-dev rollup rollup-plugin-stylus-compiler rollup-plugin-css-porter stylus // rollup.config.js import stylus from 'rollup-plugin-stylus-compiler'; import css from 'rollup-plugin-css-porter'; export default { input: 'src/main.js', plugins: [stylus(), css()], output: { format: 'es', file: 'dist/bundle.js' } }; // src/main.js import './style.styl'; // outputs dist/bundle.css and dist/bundle.min.css via css-porter
Debug
Known issues
deprecatedPackage not updated since 2019; Stylus updates may cause incompatibilities.
fix
Consider using rollup-plugin-postcss which supports Stylus via options: plugins: [postcss({ preprocessor: 'stylus' })].
affects: >=1.0.1
breakingRequires Stylus as a peer dependency; missing Stylus will cause runtime error.
fix
Install stylus: npm install --save-dev stylus
affects: >=1.0.0
gotchaPlugin only transforms .styl/.stylus files; CSS output must be handled by an additional plugin.
fix
Add a CSS output plugin like rollup-plugin-css-porter, rollup-plugin-css-only, or rollup-plugin-postcss after stylus().
affects: >=1.0.0
gotchaThe default export is a function; calling it without parentheses results in a broken build.
fix
Use stylus() not stylus.
affects: >=1.0.0
gotchaRollup v1.x compatible only; does not support Rollup v2+ or v3+.
fix
Use rollup-plugin-postcss or fork/update the plugin.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: stylus is not a function
Importing the plugin incorrectly as an object instead of calling as a function.
fix
Ensure you use stylus() in your plugins array, not stylus.
Error: Cannot find module 'stylus'
Stylus peer dependency not installed.
fix
Run: npm install --save-dev stylus
Error: [plugin: rollup-plugin-stylus-compiler] Could not load /path/to/file.styl
Stylus file path is incorrect or file does not exist.
fix
Verify the import path in your JavaScript file (e.g., import './style.styl').
Error: Unexpected token (Note that you need plugins to import files that are not JavaScript)
Rollup is trying to parse the .styl file without the plugin being applied.
fix
Add stylus() to the plugins array in your Rollup config.
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies
stylusrequiredPeer dependency required for Stylus compilation.
Agent activity
6 hits · last 30 days
node
6
Resources
rollup-plugin-stylus-compiler — npm install rollup-plugin-stylus-compiler · libregistry