Wynn Netherland changelog.com/posts

Sass 3.1 released, now with functions, lists, and @media bubbling

Sass continues to provide innovative new ways to DRY up our CSS. Version
3.1 is
and offers many new language features, compilation performance improvements, and some new command line options.

Sass, extend thyself with Sass-based functions

Rubyists have long had the ability to extend Sass, but now anyone can
create powerful functions using only Sass:

$grid-width: 40px;
$gutter-width: 10px;

@function grid-width($n) {
  @return $n * $grid-width + ($n - 1) * $gutter-width;


Sass now includes some handy functions to work with lists introduced in
version 3.0 including nth, append, join, and length:

$ sass -i
>> nth(1px 2px 10px, 2)
>> append(1px 2px, 5px)
(1px 2px 5px)
>> length(5px 10px)

There is also a new @each directive to iterate over lists:

@each $animal in puma, sea-slug, egret, salamander {
  .#{$animal}-icon {
    background-image: url('/images/#{$animal}.png');

New command line utility and breaking changes

Sass 3.1 brings changes to command line tools and some breaking changes:

  • There is a new scss command line utility to compile stylesheets, defaulting to the SCSS syntax.
  • @import used with a path without a file extension will now throw an error
  • Old-style ! variable support has been removed
  • The css2sass command line utility has been removed in favor of sass-convert.

Check out the
for complete release details. For a deeper look at Sass and Compass, check out our upcoming book Sass and Compass in Action from Manning, now in early access.

[Source on GitHub]


Sign in or Join to comment or subscribe

Player art
  0:00 / 0:00