60
Authoring Stylesheets With Sass and Compass Monday, November 29, 2010

SASS: The Next Wave in Styling and Theming

  • Upload
    sencha

  • View
    868

  • Download
    0

Embed Size (px)

Citation preview

Authoring StylesheetsWith Sass and Compass

Monday, November 29, 2010

Chris EppsteinSoftware Architect for Caring.comCreator of CompassMember of Sass Core Team

You’re there for them. We’re here for you.

Follow@chriseppstein

Monday, November 29, 2010

Sencha Touch Uses Sass & Compass

Monday, November 29, 2010

Hold on to Your HatWe’ve got a lot to learn.

Stylesheets have grown up.

Monday, November 29, 2010

Today•Learn the Sass Syntax and features•Learn your way around a Compass project•Overview of Compass Libraries•Style a webpage in minutes•Discover a new approach to design

Monday, November 29, 2010

CSS333 New Selectors120+ New Properties3 New @-rulesEnhanced Media Queries

Monday, November 29, 2010

CSS3More SophisticatedMore PowerfulMore Complex

Monday, November 29, 2010

CSS3More SophisticatedMore PowerfulMore Complex

No new Syntax To Manage Complexity.

Monday, November 29, 2010

Sass & CompassA workhorse for CSS developers.

Simplifying CSS Using Abstractions.

Monday, November 29, 2010

What is Sass?What is Compass?

Monday, November 29, 2010

Sass Features• Variables• Nested Rules• Mixins• Selector Inheritance• Colors• Math• Conditionals• Server-side Imports• Output Formatting & Compression• Silent Comments• Optional Whitespace- Aware Syntax

Monday, November 29, 2010

Sass Syntax

Sass CSS

Monday, November 29, 2010

Sass: Variables

Sass CSS

Monday, November 29, 2010

Sass: Nested Rules

Sass CSS

Monday, November 29, 2010

Sass: Mixins

Sass CSS

Monday, November 29, 2010

Mixins: Write Your Own

Monday, November 29, 2010

Sass: Selector Inheritance

Sass CSS

Monday, November 29, 2010

Sass: Colors

Sass CSS

Monday, November 29, 2010

Sass: Colors • mix

• darken/lighten

• transparentize/opacify

• compliment/adjust-hue

• saturate/desaturate/grayscale

• accessors & more

Functions

http://sass-lang.com/docs/yardoc/Sass/Script/Functions.html

• hex

• rgb() / rgba()

• hsl() / hsla()

• Named Colors

Representations

Monday, November 29, 2010

Sass: Mathematical Expressions

Sass CSS

Monday, November 29, 2010

Sass: Numeric Units •Handles any unit

•Allows complex units in intermediate forms

•Understands compatible units

Examples

Monday, November 29, 2010

Sass: Conditionals

Monday, November 29, 2010

Sass: Server Side Imports

_sidebar.scss

screen.scss screen.cssMonday, November 29, 2010

Sass: Output Formats

Nested Expanded

Compact

Compressed

Monday, November 29, 2010

Sass: Alternate Syntax

Monday, November 29, 2010

Sass: Alternate Syntax

Monday, November 29, 2010

Questions about Sass?

?Monday, November 29, 2010

CSS is 14 years OldWe’ve developed Some Best Practices

OOCSS

Monday, November 29, 2010

CSS FrameworksA Codification of Best Practices

OOCSS

Monday, November 29, 2010

CompassA Real Stylesheet Framework

OOCSSNot Frameworks

Monday, November 29, 2010

CompassA Stylesheet Authoring Framework

• Project Context• Core Library• Semantic Frameworks• Extensions• Community

Monday, November 29, 2010

Project ContextCreate a new project in seconds

compass create <project> --using <framework>

Monday, November 29, 2010

Compass will Watch for changes and compile automatically

compass watch

Project Context

Monday, November 29, 2010

Self documenting

compass help

If you need Help

Monday, November 29, 2010

If you need HelpOnline Documentation

Monday, November 29, 2010

If you need HelpThe Community

http://groups.google.com/group/compass-usershttp://groups.google.com/group/haml

Monday, November 29, 2010

Projects are more than just Stylesheets•Images•Fonts•JavaScripts

Monday, November 29, 2010

Where are your Assets?

assets.scss

Monday, November 29, 2010

Relative Assets:No Web Server Required

assets.scss

assets.css

config.rb

Monday, November 29, 2010

Absolute Assets:Web Server Required

assets.scss

assets.css

config.rb

Monday, November 29, 2010

Set an ApplicationPath Context

assets.scss

assets.css

config.rb

Monday, November 29, 2010

Image Host(CDN/S3/etc)

assets.scss

assets.css

config.rb

Monday, November 29, 2010

Use Asset Hosts

assets.scss

assets.css

config.rb

Monday, November 29, 2010

Asset Helpers

stylesheet-url - url to assets stored in the CSS directoryfont-url - url to assets in the font directoryimage-url - url to assets in the images directoryinline-image - embed an imageinline-font-files - embed a font file

http://compass-style.org/docs/reference/compass/helpers/urls/

Monday, November 29, 2010

CSS3It’s pretty cool.But it’s still a work in progress:

Vendor prefix hellIncompatible syntaxesGraceful degradation / progressive enhancement considerationsBuggy implementations

Monday, November 29, 2010

Prefix Hell

Really?Who does this?

What a Pain.

Simple.Like it Will Be.

Only now.Monday, November 29, 2010

Compass CSS3 Modules

Background ClipBackground OriginBackground SizeBorder RadiusBoxBox ShadowBox SizingColumns

Font FaceGradientInline BlockOpacityText ShadowTransformTransition

http://compass-style.org/docs/reference/compass/css3/

Updated for you as browsers develop

Monday, November 29, 2010

Compass UtilitiesResetsSticky FooterClearfixCross browser best practices: floats, minsLinks: hover-link, link-colors, unstyled-linkLists: pretty bullets, no-bullets, horizontal lists, inline listsSpritesTables: striping borders & basic stylingText: ellipsis, no-wrap, text-replacement

http://compass-style.org/docs/reference/compass/utilities/

Monday, November 29, 2010

Browser SupportAll Modern BrowsersFirefox 2IE6 & 7Exceptions are noted in the docs.Compass ♥’s progressive enhancement

Monday, November 29, 2010

The Zen of Sass‣ Beautiful Markup‣ Stylesheets that you can

visualize‣ Keep presentation in your

stylesheets.‣ Find your own code style‣ Build your own framework‣ Don’t use what you don’t like

Monday, November 29, 2010

SusyCreated by an Eric Meyer for CompassUses Natalie Down’s CSS Systems approach to grids.Can be elastic, fixed, or fluid.Vertical RhythmUtilities

http://susy.oddbird.net/

Monday, November 29, 2010

My TeammatesNathan Wiezenbaum (@nex3) - Sass & HamlEric Meyer (@eriiicam) - Compass, SusyBrandon Mathis (@imathis) - Compass, Fancy Buttons

Monday, November 29, 2010

Compass is Charityware

If you use Compass & Sass and they make your life better, please help make someone else’s life better by making a tax-deductible donation to the United Mitochondrial Disease Foundation.http://umdf.org/compass

Monday, November 29, 2010

Questions about Compass?

?Monday, November 29, 2010