Stylus

Expressive, robust, feature-rich CSS language built for nodejs

README

Stylus

Build Status npm version npm Join the community on Spectrum

Stylus is a revolutionary new language, providing an efficient, dynamic, and expressive way to generate CSS. Supporting both an indented syntax and regular CSS style.

Installation


  1. ```bash
  2. $ npm install stylus -g
  3. ```

Basic Usage

Watch and compile a stylus file from command line with
  1. ```bash
  2. stylus -w style.styl -o style.css
  3. ```
You can also try all stylus features on stylus-lang.com, build something with stylus on codepen or integrate stylus with gulp using gulp-stylus or gulp-accord.

Example


  1. ```stylus
  2. border-radius()
  3.   -webkit-border-radius: arguments
  4.   -moz-border-radius: arguments
  5.   border-radius: arguments

  6. body a
  7.   font: 12px/1.4 "Lucida Grande", Arial, sans-serif
  8.   background: black
  9.   color: #ccc

  10. form input
  11.   padding: 5px
  12.   border: 1px solid
  13.   border-radius: 5px
  14. ```

compiles to:

  1. ```css
  2. body a {
  3.   font: 12px/1.4 "Lucida Grande", Arial, sans-serif;
  4.   background: #000;
  5.   color: #ccc;
  6. }
  7. form input {
  8.   padding: 5px;
  9.   border: 1px solid;
  10.   -webkit-border-radius: 5px;
  11.   -moz-border-radius: 5px;
  12.   border-radius: 5px;
  13. }
  14. ```

the following is equivalent to the indented version of Stylus source, using the CSS syntax instead:

  1. ```stylus
  2. border-radius() {
  3.   -webkit-border-radius: arguments
  4.   -moz-border-radius: arguments
  5.   border-radius: arguments
  6. }

  7. body a {
  8.   font: 12px/1.4 "Lucida Grande", Arial, sans-serif;
  9.   background: black;
  10.   color: #ccc;
  11. }

  12. form input {
  13.   padding: 5px;
  14.   border: 1px solid;
  15.   border-radius: 5px;
  16. }
  17. ```

Features


Stylus has _many_ features.  Detailed documentation links follow:

  - css syntax support
  - mixins
  - variables
  - arithmetic, logical, and equality operators
  - importing of other stylus sheets
  - type coercion
  - @extend
  - iteration
  - nested selectors
  - parent reference
  - in-language functions
  - built-in functions (over 60)
  - optional image inlining
  - optional compression
  - JavaScript API
  - extremely terse syntax
  - stylus executable
  - single-line and multi-line comments
  - css literal
  - character escaping
  - @keyframes support & expansion
  - @font-face support
  - @media support
  - Connect Middleware
  - TextMate bundle
  - Coda/SubEtha Edit Syntax mode
  - gedit language-spec
  - VIM Syntax
  - Espresso Sugar
  - heroku web service for compiling stylus
  - style guide parser and generator
  - transparent vendor-specific function expansion

Community modules


  - https://github.com/stylus/stylus/wiki

Framework Support


   - Connect
   - Play! 2.0
   - Meteor
   - Grails
   - Derby
   - Laravel

CMS Support


   - DocPad
   - Punch

Screencasts



Authors



More Information


  - Language comparisons

Code of Conduct


Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

License


(The MIT License)

Copyright (c) Automattic <developer.wordpress.com>

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.