Skip to content

Instantly share code, notes, and snippets.

@jraines
Created May 18, 2011 15:18
Show Gist options
  • Save jraines/978782 to your computer and use it in GitHub Desktop.
Save jraines/978782 to your computer and use it in GitHub Desktop.
Notes on SASS presentation - RailsConf 2011

Use this format to assign variables:

$error-red: #911

Transformations:

background-color: lighten(red, 10%)

Functions:

Partials

  • Begin with underscore, import with @import partial_name;
  • You can also import a whole folder

Loops

Scope your selectors with custom body ids & classes

Parent reference

#parent {
  a {
    &:hover { }  //  
  }
}

Compass sprites

Mixins

@mixin hovered {
  text-decoration: none
  &:hover {
    text-decoreation: underline;
  }
}

#nav.a {
  @include hovered
}

Selector inheritance

.feedback {
  font-weight:bold;
}

.error {
  @extend .feedback;
  border-color: red;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment