Expressive, dynamic, robust CSS

Auckland CSS Meetup, 27 Aug 2015

Rob Anderson  @iotaweb

rob.anderson@iota.co.nz

What we'll cover

  • What is a CSS preprocessor?

  • Introduction to Stylus

  • Demos

What is a CSS Preprocessor?

  • A language that compiles to CSS
  • An abstraction of CSS
  • A tool to extend and enhance CSS
  • Programmatic CSS

How they work

WRITE 

COMPILE

USE

Create using your preferred CSS preprocessor

Compiles to standard CSS

Command line
Helper Application
Javascript taskrunner, 
e.g. Gulp or Grunt

Why use a CSS Preprocessor?

   Keeps your CSS DRY (Don't Repeat Yourself)

   Reinforces good practices

   Supports code reuse

   Supports maintainability

   Enhances readability

   Makes difficult tasks easier

Workflow & Tools

CodeKit  Mac

Terminal  Mac / Windows

Prepos  Windows

Grunt & Gulp  Mac / Windows

Introduction to Stylus

TJ Holowaychuk

@tjholowaychuk

Express

Jade

Mocha

 

Features

  • Optional colons
  • Optional semi-colons
  • Optional commas
  • Optional braces
  • Variables
  • Interpolation
  • Mixins
  • Arithmetic
  • Type coercion
  • Dynamic importing
  • Conditionals
  • Iteration

  • Nested selectors
  • Parent referencing
  • Variable function calls
  • Lexical scoping
  • Built-in functions (60+)
  • In-language functions
  • Optional compression
  • Optional image inlining
  • Stylus executable
  • Robust error reporting
  • Single-line and multi-line comments
  • CSS literal for those tricky times
  • Character escaping
  • TextMate bundle
  • Uses NodeJS
  • JavaScript API

Walkthrough

Try it out!

Documentation

Demos

Newspaper Layout Engine

Thank you!

Stylus

By iotaweb

Stylus

A presentation for the Auckland CSS meetup.

  • 390