Stylus | |
Designer: | TJ Holowaychuk |
Developer: | LearnBoost (-) / Automattic (- Present)[1] |
Latest Release Version: | 0.63.0[2] |
Typing: | dynamic |
Influenced By: | CSS, Sass, Less |
Operating System: | Cross-platform |
License: | MIT License |
Website: | Stylus (Github) |
File Ext: | .styl |
Stylus is a dynamic stylesheet preprocessor language that is compiled into Cascading Style Sheets (CSS). Its design is influenced by Sass and Less. It is regarded as the fourth most used CSS preprocessor syntax.[3] It was created by TJ Holowaychuk, a former programmer for Node.js and the creator of the Luna language. It is written in JADE and Node.js.
Unlike CSS, which uses braces to open and close declaration blocks, indentation is used. Additionally, semi-colons (;) are optionally omitted. Hence, the following CSS:
Stylus allows variables to be defined, however unlike Less and Sass, it doesn't use a symbol to define variables. Additionally, variable assignment is done automatically by separating the property and keyword(s). In this way, variables are similar to the variables in Python.
div::before content message color #ffffff
The Stylus compiler would translate the above document to:
Both mixins and functions are defined in the same manner, but they are applied in different ways.
For example, if you wanted to define the CSS border radius property without having to use various Vendor Prefixes you can create:
then, to include this as a mixin, you would reference it as:
this would compile to:
To include variables in arguments and identifiers, brace characters surround the variable(s). For example,