LinuxCommandLibrary

stylus

TLDR

Compile Stylus file to CSS

$ stylus [style.styl]
copy
Compile to specific output file
$ stylus [style.styl] -o [style.css]
copy
Watch for changes and compile
$ stylus -w [style.styl] -o [style.css]
copy
Compile with compression
$ stylus -c [style.styl]
copy
Compile all files in directory
$ stylus [src/] -o [dist/]
copy
Convert CSS to Stylus
$ stylus --css [style.css] [style.styl]
copy
Generate source maps
$ stylus --sourcemap [style.styl]
copy

SYNOPSIS

stylus [options] [file|dir...]

DESCRIPTION

stylus is a command-line compiler for the Stylus CSS preprocessor. Stylus is an expressive, dynamic CSS language built for Node.js that features flexible syntax, powerful functions, and robust feature set.
The compiler transforms Stylus source files (.styl) into standard CSS. Stylus syntax is flexible, allowing optional colons, semicolons, and braces, making stylesheets more readable. It supports variables, mixins, functions, iteration, and many other features that extend CSS capabilities.
The watch mode enables automatic recompilation during development. Source maps aid debugging by mapping compiled CSS back to original Stylus sources. The CSS conversion feature helps migrate existing stylesheets to Stylus.

PARAMETERS

-o, --out dir

Output to specified directory or file.
-w, --watch
Watch files for changes and recompile.
-c, --compress
Compress CSS output.
--css input output
Convert CSS to Stylus format.
-m, --sourcemap
Generate source map files.
-l, --line-numbers
Add line number comments to output.
-i, --interactive
Start interactive REPL.
-U, --inline
Inline images as data URIs.
-u, --use plugin
Use specified plugin.
-I, --include path
Add path to import lookup.
--import file
Import file before compiling.
-p, --print
Print compiled CSS to stdout.
--prefix prefix
Add vendor prefixes.
-V, --version
Display version.
-h, --help
Display help.

CAVEATS

Requires Node.js and npm for installation. The flexible syntax can be confusing for teams without consistent conventions. Performance may be slower than other preprocessors for large projects. Stylus has less community adoption compared to Sass/SCSS.

HISTORY

Stylus was created by TJ Holowaychuk (creator of Express.js) and released in 2010. It was designed to be more expressive and flexible than existing CSS preprocessors. While it gained significant adoption, Sass/SCSS eventually became more dominant in the CSS preprocessor ecosystem.

SEE ALSO

sass(1), less(1), postcss(1), npm(1)

Copied to clipboard