TRANSPARENCY

– and –

LEAVING PROBLEMS WHERE THEY BELONG

THE LANDSCAPE

LESS, SASS, and Stylus

LESS

Twitter built bootstrap with it, so it can't be that bad right?

@base: #f938ab;

.box-shadow(@style, @c) when (iscolor(@c)) {
  -webkit-box-shadow: @style @c;
  box-shadow:         @style @c;
}
.box-shadow(@style, @alpha: 50%) when (isnumber(@alpha)) {
  .box-shadow(@style, rgba(0, 0, 0, @alpha));
}
.box {
  color: saturate(@base, 5%);
  border-color: lighten(@base, 30%);
  div { .box-shadow(0 0 5px, 30%) }
}

SASS

It's built on Ruby. Everyone uses Ruby.

(I don't...I did.)

@mixin border-radius($radius) {
  -webkit-border-radius: $radius;
     -moz-border-radius: $radius;
      -ms-border-radius: $radius;
          border-radius: $radius;
}

.box { @include border-radius(10px); }

.scss

=border-radius($radius)
  -webkit-border-radius: $radius
  -moz-border-radius:    $radius
  -ms-border-radius:     $radius
  border-radius:         $radius

.box
  +border-radius(10px)

.sass

Stylus

TJ Holowaychuck wrote it, it must be good.

border-radius()
  -webkit-border-radius arguments
  -moz-border-radius arguments
  border-radius arguments

body
  font 12px Helvetica, Arial, sans-serif

a.button
  border-radius 5px

LET'S TAKE A WALK

The path that got us here

EVERY PRE-PROCESSOR SOLVES "THE PROBLEM"

Less wet CSS (Maybe)

Maintainable CSS (Perhaps)

Smooths browser inconsistencies (Usually)

Logic in your CSS!

FORKS WORK WELL

Until you need to eat soup

LOOK AROUND

There are people smarter than you

SKEPTICISM

You probably haven't found the right tool yet

HEAD FIRST

Finding the problems

LITMUS TEST

...or the chopping block

@include border-radius(5px)

yet 90% of browsers support the unprefixed:

SASS asks me to write:

border-radius: 5px;

If my measure of success was typing less (ha. ha.), then this works:

.border-radius(5px)

...but none of these felt right.

Stylus

Browser Prefixing

.foo
    border-radius: 5px
.foo{
    -moz-border-radius: 5px;
    -webkit-border-radius: 5px;
    -o-border-radius: 5px;
    border-radius: 5px;
}

...there's a transparent mixin here as well.

Stylus

Transparent Mixins

.bar
    fixed: top left
    color: red
.bar{
    position: fixed;
    top: 0;
    left: 0;
    color: red;
}

Instead of...

.bar{
    @include fixed-positioning(top, left);
    color: red;
}

Stylus

It's really good looking

* + *
  margin-top $baseLineHeight


body
  font-family $bodyFont
  font-size $bodyFontSize
  line-height $baseLineHeight
  color $baseFontColor
  margin 40px
class Coffee extends Beans
  initialize: ->
    console.log 'Brewing...'

especially if you're used to writing coffeescript

THE LANGUAGE

had me at 'Hello' (World)

CSS3 WILL BECOME REAL

Sometime around the release of CSS5 ;)

THE ENVIRONMENT

It's fragile. Take care of it, and don't litter

WHERE WE BEGAN

is not where we are now

ALL THESE TOOLS

and there's no wrench?

JUSTJAVASCRIPT™

BEM [block, element, modifier]

MODULES [no seriously. modules.]

CSS IS ENOUGH

Plus...you don't have a choice

THE PROBLEMS AT HAND

are BY DESIGN....eek.

specificity wars

indeterminate selectors

inconsistent implementations

half-implemented specifications

etc...

UNABLE TO ESCAPE

you must live with what you have

KNOW THE ROAD

It may not have been clear, but it is now

MY REQUIREMENTS

  • Let me write beautiful code
  • Let me write it however I see fit.
  • Let others join me in writing beautiful code.
  • Don't make me constantly consult the docs,
    I already know CSS.
  • Don't make me use plugins that are a bajillion MB.
  • Don't make decisions for me.
  • Don't add another environment to my stack.

SIMPLIFY

THE COMMUNITY

THE LONELY CREW

SASS

Building beautiful stuff, 

for freaking ever.

Bourbon,

Neat,

Bitters,

Refills.

So many options that there's a tool for finding all of the great stuff. (Sache)

Stylus

A really strong core

Jeet (Grid), Rupture (Responsive Design) and Axis (Bootstrap-like) are additional tools that may help those coming from a large library like Compass, feel at home.

@import 'nib'

FORCED CREATIVITY

It's not so bad.

IT GETS EVEN BETTER

and it all moves REALLY fast

THANK YOU

Want to know what all I'm fussing about?

nick@bolsterlabs.com

Discussion

By Nick Hudkins

Discussion

  • 550