{"id":22237,"library":"rollup-plugin-stylus-compiler","title":"rollup-plugin-stylus-compiler","description":"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.","status":"maintenance","version":"1.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/RJHwang/rollup-plugin-stylus-compiler","tags":["javascript","rollup","rollup-plugin","stylus","css"],"install":[{"cmd":"npm install rollup-plugin-stylus-compiler","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-stylus-compiler","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-stylus-compiler","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency required for Stylus compilation.","package":"stylus","optional":false}],"imports":[{"note":"CommonJS require works but is not recommended for future-proofing. The package has no named exports.","wrong":"const stylus = require('rollup-plugin-stylus-compiler')","symbol":"default import (stylus function)","correct":"import stylus from 'rollup-plugin-stylus-compiler'"},{"note":"The default export is a factory function; it must be called with optional options (e.g., stylus({ compress: true })).","wrong":"plugins: [stylus]","symbol":"Plugin invocation","correct":"plugins: [stylus()]"},{"note":"Order matters: stylus() must come before CSS output plugins.","wrong":"","symbol":"Using with rollup-plugin-css-porter","correct":"import stylus from 'rollup-plugin-stylus-compiler';\nimport css from 'rollup-plugin-css-porter';\n\nexport default { plugins: [stylus(), css()] }"}],"quickstart":{"code":"// Install: npm install --save-dev rollup rollup-plugin-stylus-compiler rollup-plugin-css-porter stylus\n// rollup.config.js\nimport stylus from 'rollup-plugin-stylus-compiler';\nimport css from 'rollup-plugin-css-porter';\n\nexport default {\n  input: 'src/main.js',\n  plugins: [stylus(), css()],\n  output: {\n    format: 'es',\n    file: 'dist/bundle.js'\n  }\n};\n\n// src/main.js\nimport './style.styl';  // outputs dist/bundle.css and dist/bundle.min.css via css-porter","lang":"javascript","description":"Shows minimal setup with rollup-plugin-css-porter to compile .styl and output CSS files."},"warnings":[{"fix":"Consider using rollup-plugin-postcss which supports Stylus via options: plugins: [postcss({ preprocessor: 'stylus' })].","message":"Package not updated since 2019; Stylus updates may cause incompatibilities.","severity":"deprecated","affected_versions":">=1.0.1"},{"fix":"Install stylus: npm install --save-dev stylus","message":"Requires Stylus as a peer dependency; missing Stylus will cause runtime error.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Add a CSS output plugin like rollup-plugin-css-porter, rollup-plugin-css-only, or rollup-plugin-postcss after stylus().","message":"Plugin only transforms .styl/.stylus files; CSS output must be handled by an additional plugin.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use stylus() not stylus.","message":"The default export is a function; calling it without parentheses results in a broken build.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use rollup-plugin-postcss or fork/update the plugin.","message":"Rollup v1.x compatible only; does not support Rollup v2+ or v3+.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Ensure you use stylus() in your plugins array, not stylus.","cause":"Importing the plugin incorrectly as an object instead of calling as a function.","error":"TypeError: stylus is not a function"},{"fix":"Run: npm install --save-dev stylus","cause":"Stylus peer dependency not installed.","error":"Error: Cannot find module 'stylus'"},{"fix":"Verify the import path in your JavaScript file (e.g., import './style.styl').","cause":"Stylus file path is incorrect or file does not exist.","error":"Error: [plugin: rollup-plugin-stylus-compiler] Could not load /path/to/file.styl"},{"fix":"Add stylus() to the plugins array in your Rollup config.","cause":"Rollup is trying to parse the .styl file without the plugin being applied.","error":"Error: Unexpected token (Note that you need plugins to import files that are not JavaScript)"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}