Linux command
stylus 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Compile Stylus file to CSS
stylus [style.styl]
Compile to specific output file
stylus [style.styl] -o [style.css]
Watch for changes and compile
stylus -w [style.styl] -o [style.css]
Compile with compression
stylus -c [style.styl]
Compile all files in directory
stylus [src/] -o [dist/]
Convert CSS to Stylus
stylus -C [style.css] [style.styl]
Generate source maps
stylus --sourcemap [style.styl]
说明
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.
参数
- -o, --out _dir_
- Output to specified directory or file.
- -w, --watch
- Watch files for changes and recompile.
- -c, --compress
- Compress CSS output.
- -C, --css _src_ _dest_
- Convert CSS input to Stylus.
- -m, --sourcemap
- Generate v3 source maps.
- --sourcemap-inline
- Inline the source map as base64 in the output.
- -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.
- -r, --resolve-url
- Resolve relative URLs inside imports.
- --include-css
- Include regular CSS on @import.
- --import _file_
- Import file before compiling.
- -p, --print
- Print compiled CSS to stdout.
- -d, --compare
- Display both input and compiled output.
- -D, --deps
- Display dependent files.
- -P, --prefix _prefix_
- Prefix all CSS class names.
- -V, --version
- Display version.
- -h, --help
- Display help.
FAQ
What is the stylus command used for?
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.
How do I run a basic stylus example?
Run `stylus [style.styl]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -o, --out _dir_ do in stylus?
Output to specified directory or file.