Finding your way with Sass+Compass

D
finding your way
with sass+compass



       ben@cornershopcreative.com
WHAT IS SASS?

Sass is a CSS Pre-processor
or meta-language
Sass is a “competitor” to LESS
and Stylus
Sass is written in Ruby
Sass is pretty cool
WHAT IS COMPASS?

Compass is an open-source
library of Sass mixins.
Compass is a CSS authoring
framework.
Compass is what makes Sass
really, really useful.
WHAT SASS DOES

Introduces new things to CSS:
  • nested rules
  • variables
  • mixins
  • inheritance
  • and much more!
GETTING GOING
in your development environment*




                * you don’t need sass on prod!
STEP BY STEP
1.Install ruby (I use rvm)
 $ curl -L https://get.rvm.io | bash -s stable --ruby


2.Install the compass “gem”
 $ gem update --system
 $ gem install compass


3.Install compass-normalize (optional)
 $ gem install compass-normalize


4.Confirm installation
 $ compass version
STEP BY STEP

5. Set up a project!
 $ compass create <foldername> ...or...
 $ compass install compass --syntax sass




                                           live demo time!
PROBLEMS?
http://compass-style.org/install/ is your friend
TWO SYNTAXES
SCSS                         SASS
.selector {                  .selector
  color: green;                color: green
  border:1px solid $black;     border:1px solid $black
  @include inline-block;       +inline-block
  li {                         li
       display: block;            display: block
    font:                         font:
       family: $sans;               family: $sans
       size: 122%;                  size: 122%
  }                               @extend .navitem
}
                             .other-selector
  .other-selector {}
THE PROCESS

1.Write your Sass
2.Compile your Sass into CSS
3.Include your CSS on prod
4.Bask in glory
LET’S TRY IT
showing is better than telling, right?
WE JUST COVERED

   Compiling Sass files with
    compass watch and
     compass compile
Using @imports and underscores
     to control our content
    Mucking with config.rb
VARIABLES & MIXINS
  and some math, just for fun!
VARIABLES
   $sans:   “Helvetica Neue”, Helvetica, Arial, sans-serif
$display:   “Lobster”, Impact, serif
   $tiny:   Verdana, sans-serif
   $evil:   Comic Sans, sans-serif

  $where: left
 $radius: 5px
   $base: 14px

   $dark:   #222
  $light:   #fff
$seethru:   rgba($light, 0.2)
   $grey:   $dark + #444    //or lighten($dark, 40%)
    $red:   #971219



                    doing this in _variables.sass is a good idea
VARIABLES IN ACTION!
 .redtext
   color: $red

 article
   font:
      family: $sans
      size: $base
   color: $dark
   background-color: $seethru
   h1
      font: #{$base * 2}/#{$base * 2.2} $display
      @extend .redtext
      &.title
        text-transform: uppercase

  .#{$where}-rail
    width: 200px
MIXINS
=notext
  overflow: hidden
  white-space: nowrap
  text-indent: 105%
  text-align: left

=float( $dir:   left )
  float: $dir
  @if $dir ==   left
    margin: 0   10px 5px 0
  @else
    margin: 0   0 5px 10px

.alignleft
  +float(right)
ENTER COMPASS
 mixin magic and more
CROSS-BROWSER STUFF
+opacity(0.6)


filter:
progid:DXImageTransform.Microsoft.Alpha(Opacity=60);
opacity: 0.6;


+inline-block        display: -moz-inline-stack;
                     display: inline-block;
                     vertical-align: middle;
                     *vertical-align: auto;
                     zoom: 1;
                     *display: inline;
MOAR CROSS-BROWSER

+opacity(0.6)
+clearfix
+legacy-pie-clearfix
+text-shadow(1px 2px 8px rgba(black, 0.3))
+box-shadow(inset 2px 4px 10px $red)
+border-radius(8px)
+box-sizing(border-box)
FANCY CSS3 = EASY!

+single-transition(all, 0.3s, ease)
+rotate(20deg)
+scale(1.2)
+background-image(linear-gradient(top, $red, $red - #222))




    http://compass-style.org/reference
SPRITES FTW
THE PROCESS

1.Create a sub-directory in /images/
2.Save your sprite png’s in there
3.Tell Compass to create classes
4.Celebrate
EXAMPLE
// gives us .mysprites-[filename]
@import "mysprites/*.png"
$mysprites-sprite-dimensions: true //sets dimensions
+all-mysprites-sprites


/* so if images/mysprites/logo.png is 200x100, then...
.mysprites-logo
  width: 200px;
     height: 100px;
     background: url(images/mysprites-3434034734.png) no-repeat;
     background-position: [whatever] [whatever];
*/


h1#logo
  @extend .mysprites-logo
OTHER STUFF
 random other tricks
WELL THAT’S HANDY
h1
  font-size: 40px
  @media screen and (max-width: $break-small)
    font-size: 30px

a.heading
  background-image: image-url(‘filename.jpg’)
  &:hover
    +scale(1.1)
  .no-csstransforms &:hover
    text-decoration: underline


$fullwidth: 960px
.rail
  width: percentage(220px/$fullwidth)
  margin: percentage(10px/$fullwidth)
FOR MORE...

       http://sass-lang.com
     http://compass-style.org
http://www.kaelig.fr/bettersassdocs/
      http://thesassway.com
CONNECT
        Ben Byrne
ben@cornershopcreative.com
   facebook.com/drywall
     Twitter: @drywall
1 von 27

Recomendados

CSS Extenders von
CSS ExtendersCSS Extenders
CSS ExtendersIdan Gazit
4.6K views52 Folien
Compass, Sass, and the Enlightened CSS Developer von
Compass, Sass, and the Enlightened CSS DeveloperCompass, Sass, and the Enlightened CSS Developer
Compass, Sass, and the Enlightened CSS DeveloperWynn Netherland
3K views116 Folien
Less vs sass von
Less vs sassLess vs sass
Less vs sassAya Edamoto
12.7K views16 Folien
Authoring Stylesheets with Compass & Sass von
Authoring Stylesheets with Compass & SassAuthoring Stylesheets with Compass & Sass
Authoring Stylesheets with Compass & Sasschriseppstein
5K views59 Folien
Bringing sexy back to CSS: SASS/SCSS, LESS and Compass von
Bringing sexy back to CSS: SASS/SCSS, LESS and CompassBringing sexy back to CSS: SASS/SCSS, LESS and Compass
Bringing sexy back to CSS: SASS/SCSS, LESS and CompassClaudina Sarahe
3K views28 Folien
CSS Preprocessors: LESS is more or look SASS-y trying von
CSS Preprocessors: LESS is more or look SASS-y tryingCSS Preprocessors: LESS is more or look SASS-y trying
CSS Preprocessors: LESS is more or look SASS-y tryingJames Cryer
1.9K views19 Folien

Más contenido relacionado

Was ist angesagt?

Accelerated Stylesheets von
Accelerated StylesheetsAccelerated Stylesheets
Accelerated StylesheetsWynn Netherland
1.3K views147 Folien
Drupal & CSS Preprocessors von
Drupal & CSS PreprocessorsDrupal & CSS Preprocessors
Drupal & CSS Preprocessorskdmarks
8.5K views40 Folien
Sass and compass workshop von
Sass and compass workshopSass and compass workshop
Sass and compass workshopShaho Toofani
982 views171 Folien
SASS is more than LESS von
SASS is more than LESSSASS is more than LESS
SASS is more than LESSItai Koren
1.2K views32 Folien
McrFRED 39 | CSS Processors von
McrFRED 39 | CSS ProcessorsMcrFRED 39 | CSS Processors
McrFRED 39 | CSS ProcessorsTristan Ashley
311 views51 Folien
Css to-scss von
Css to-scssCss to-scss
Css to-scssfrontendne
1.1K views18 Folien

Was ist angesagt?(20)

Drupal & CSS Preprocessors von kdmarks
Drupal & CSS PreprocessorsDrupal & CSS Preprocessors
Drupal & CSS Preprocessors
kdmarks8.5K views
SASS is more than LESS von Itai Koren
SASS is more than LESSSASS is more than LESS
SASS is more than LESS
Itai Koren1.2K views
Css to-scss von frontendne
Css to-scssCss to-scss
Css to-scss
frontendne1.1K views
Write LESS. DO more. von Eugene Nor
Write LESS. DO more.Write LESS. DO more.
Write LESS. DO more.
Eugene Nor658 views
Introduction to SASS von Jon Dean
Introduction to SASSIntroduction to SASS
Introduction to SASS
Jon Dean13K views
CSS preprocessor: why and how von mirahman
CSS preprocessor: why and howCSS preprocessor: why and how
CSS preprocessor: why and how
mirahman1.9K views
Accelerated Native Mobile Development with the Ti gem von Wynn Netherland
Accelerated Native Mobile Development with the Ti gemAccelerated Native Mobile Development with the Ti gem
Accelerated Native Mobile Development with the Ti gem
Wynn Netherland954 views
Intro to css & sass von Sean Wolfe
Intro to css & sassIntro to css & sass
Intro to css & sass
Sean Wolfe3K views
Sassy CSS (part 2) (Drupal Camp LA 2013) von Chris Charlton
Sassy CSS (part 2) (Drupal Camp LA 2013)Sassy CSS (part 2) (Drupal Camp LA 2013)
Sassy CSS (part 2) (Drupal Camp LA 2013)
Chris Charlton428 views
Preprocessor presentation von Mario Noble
Preprocessor presentationPreprocessor presentation
Preprocessor presentation
Mario Noble1.3K views

Destacado

High Performance Front-End Development von
High Performance Front-End DevelopmentHigh Performance Front-End Development
High Performance Front-End Developmentdrywallbmb
779 views30 Folien
Center for Technical Education Innovation’s 2013 Spring General Advisory M… von
Center for Technical Education Innovation’s 2013 Spring General Advisory M…Center for Technical Education Innovation’s 2013 Spring General Advisory M…
Center for Technical Education Innovation’s 2013 Spring General Advisory M…Rene Lafayette
594 views90 Folien
Spotlight on France: Learning About America's Oldest Ally! von
Spotlight on France: Learning About America's Oldest Ally!Spotlight on France: Learning About America's Oldest Ally!
Spotlight on France: Learning About America's Oldest Ally!Rene Lafayette
563 views12 Folien
Presentation2 von
Presentation2Presentation2
Presentation2Le Van Tuan
98 views3 Folien
Onestatepres von
OnestatepresOnestatepres
Onestatepresguestb2206c4
206 views78 Folien
Istanbul 1993 von
Istanbul 1993Istanbul 1993
Istanbul 1993BlogNimph
357 views39 Folien

Destacado(7)

High Performance Front-End Development von drywallbmb
High Performance Front-End DevelopmentHigh Performance Front-End Development
High Performance Front-End Development
drywallbmb779 views
Center for Technical Education Innovation’s 2013 Spring General Advisory M… von Rene Lafayette
Center for Technical Education Innovation’s 2013 Spring General Advisory M…Center for Technical Education Innovation’s 2013 Spring General Advisory M…
Center for Technical Education Innovation’s 2013 Spring General Advisory M…
Rene Lafayette594 views
Spotlight on France: Learning About America's Oldest Ally! von Rene Lafayette
Spotlight on France: Learning About America's Oldest Ally!Spotlight on France: Learning About America's Oldest Ally!
Spotlight on France: Learning About America's Oldest Ally!
Rene Lafayette563 views
Istanbul 1993 von BlogNimph
Istanbul 1993Istanbul 1993
Istanbul 1993
BlogNimph357 views
The Difference Between Print and Web Design von drywallbmb
The Difference Between Print and Web DesignThe Difference Between Print and Web Design
The Difference Between Print and Web Design
drywallbmb1K views

Similar a Finding your way with Sass+Compass

Theming and Sass von
Theming and SassTheming and Sass
Theming and SassJames Pearce
3.5K views78 Folien
CSS 開發加速指南-Sass & Compass von
CSS 開發加速指南-Sass & CompassCSS 開發加速指南-Sass & Compass
CSS 開發加速指南-Sass & CompassLucien Lee
2.5K views61 Folien
SASS, Compass, Gulp, Greensock von
SASS, Compass, Gulp, GreensockSASS, Compass, Gulp, Greensock
SASS, Compass, Gulp, GreensockMarco Pinheiro
1.3K views43 Folien
Sass & Compass (Barcamp Stuttgart 2012) von
Sass & Compass (Barcamp Stuttgart 2012)Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)emrox
3.3K views26 Folien
Simple introduction Sass von
Simple introduction SassSimple introduction Sass
Simple introduction SassZeeshan Ahmed
501 views26 Folien
Mobile-first OOCSS, Sass & Compass at BBC Responsive News von
Mobile-first OOCSS, Sass & Compass at BBC Responsive NewsMobile-first OOCSS, Sass & Compass at BBC Responsive News
Mobile-first OOCSS, Sass & Compass at BBC Responsive NewsKaelig Deloumeau-Prigent
1.9K views63 Folien

Similar a Finding your way with Sass+Compass(20)

CSS 開發加速指南-Sass & Compass von Lucien Lee
CSS 開發加速指南-Sass & CompassCSS 開發加速指南-Sass & Compass
CSS 開發加速指南-Sass & Compass
Lucien Lee2.5K views
SASS, Compass, Gulp, Greensock von Marco Pinheiro
SASS, Compass, Gulp, GreensockSASS, Compass, Gulp, Greensock
SASS, Compass, Gulp, Greensock
Marco Pinheiro1.3K views
Sass & Compass (Barcamp Stuttgart 2012) von emrox
Sass & Compass (Barcamp Stuttgart 2012)Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)
emrox3.3K views
Brian Hoke: WordCamp Toronto 2014 Presentation "Sass & WordPress" von bentleyhoke
Brian Hoke: WordCamp Toronto 2014 Presentation "Sass & WordPress"Brian Hoke: WordCamp Toronto 2014 Presentation "Sass & WordPress"
Brian Hoke: WordCamp Toronto 2014 Presentation "Sass & WordPress"
bentleyhoke604 views
Getting Started with Sass & Compass von Rob Davarnia
Getting Started with Sass & CompassGetting Started with Sass & Compass
Getting Started with Sass & Compass
Rob Davarnia1.8K views
Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version) von Adam Darowski
Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)
Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)
Adam Darowski1.1K views
Advanced Technology for Web Application Design von Bryce Kerley
Advanced Technology for Web Application DesignAdvanced Technology for Web Application Design
Advanced Technology for Web Application Design
Bryce Kerley728 views
Using Sass - Building on CSS von Sayanee Basu
Using Sass - Building on CSSUsing Sass - Building on CSS
Using Sass - Building on CSS
Sayanee Basu1K views
Pacific Northwest Drupal Summit: Basic & SASS von Steve Krueger
Pacific Northwest Drupal Summit: Basic & SASSPacific Northwest Drupal Summit: Basic & SASS
Pacific Northwest Drupal Summit: Basic & SASS
Steve Krueger1.5K views
Wrangling the CSS Beast with Sass von Rob Friesel
Wrangling the CSS Beast  with SassWrangling the CSS Beast  with Sass
Wrangling the CSS Beast with Sass
Rob Friesel1.4K views
Modularization css with sass von Huiyi Yan
Modularization css with sassModularization css with sass
Modularization css with sass
Huiyi Yan625 views
Compass And Sass(Tim Riley) von elliando dias
Compass And Sass(Tim Riley)Compass And Sass(Tim Riley)
Compass And Sass(Tim Riley)
elliando dias968 views
Work and play with SASS & Compass von Andreas Dantz
Work and play with SASS & CompassWork and play with SASS & Compass
Work and play with SASS & Compass
Andreas Dantz1.4K views

Más de drywallbmb

Accessibility: Beginning the Journey von
Accessibility: Beginning the JourneyAccessibility: Beginning the Journey
Accessibility: Beginning the Journeydrywallbmb
314 views37 Folien
Do more, faster, by extending WP-CLI von
Do more, faster, by extending WP-CLIDo more, faster, by extending WP-CLI
Do more, faster, by extending WP-CLIdrywallbmb
464 views29 Folien
Accessibility: Beginning the Journey von
Accessibility: Beginning the JourneyAccessibility: Beginning the Journey
Accessibility: Beginning the Journeydrywallbmb
101 views32 Folien
Accelerating Custom Development with Dynamic Scaffolding and WP-CLI von
Accelerating Custom Development with Dynamic Scaffolding and WP-CLIAccelerating Custom Development with Dynamic Scaffolding and WP-CLI
Accelerating Custom Development with Dynamic Scaffolding and WP-CLIdrywallbmb
488 views27 Folien
Accelerating Custom Development with Dynamic Scaffolding and WP-CLI von
Accelerating Custom Development with Dynamic Scaffolding and WP-CLIAccelerating Custom Development with Dynamic Scaffolding and WP-CLI
Accelerating Custom Development with Dynamic Scaffolding and WP-CLIdrywallbmb
561 views27 Folien
Making Multisite Work for You von
Making Multisite Work for YouMaking Multisite Work for You
Making Multisite Work for Youdrywallbmb
260 views27 Folien

Más de drywallbmb(8)

Accessibility: Beginning the Journey von drywallbmb
Accessibility: Beginning the JourneyAccessibility: Beginning the Journey
Accessibility: Beginning the Journey
drywallbmb314 views
Do more, faster, by extending WP-CLI von drywallbmb
Do more, faster, by extending WP-CLIDo more, faster, by extending WP-CLI
Do more, faster, by extending WP-CLI
drywallbmb464 views
Accessibility: Beginning the Journey von drywallbmb
Accessibility: Beginning the JourneyAccessibility: Beginning the Journey
Accessibility: Beginning the Journey
drywallbmb101 views
Accelerating Custom Development with Dynamic Scaffolding and WP-CLI von drywallbmb
Accelerating Custom Development with Dynamic Scaffolding and WP-CLIAccelerating Custom Development with Dynamic Scaffolding and WP-CLI
Accelerating Custom Development with Dynamic Scaffolding and WP-CLI
drywallbmb488 views
Accelerating Custom Development with Dynamic Scaffolding and WP-CLI von drywallbmb
Accelerating Custom Development with Dynamic Scaffolding and WP-CLIAccelerating Custom Development with Dynamic Scaffolding and WP-CLI
Accelerating Custom Development with Dynamic Scaffolding and WP-CLI
drywallbmb561 views
Making Multisite Work for You von drywallbmb
Making Multisite Work for YouMaking Multisite Work for You
Making Multisite Work for You
drywallbmb260 views
Front-End Performance Optimization in WordPress von drywallbmb
Front-End Performance Optimization in WordPressFront-End Performance Optimization in WordPress
Front-End Performance Optimization in WordPress
drywallbmb3.6K views
10 Cool Things You Can Do with Widgets von drywallbmb
10 Cool Things You Can Do with Widgets10 Cool Things You Can Do with Widgets
10 Cool Things You Can Do with Widgets
drywallbmb2K views

Último

SUPPLIER SOURCING.pptx von
SUPPLIER SOURCING.pptxSUPPLIER SOURCING.pptx
SUPPLIER SOURCING.pptxangelicacueva6
15 views1 Folie
Zero to Automated in Under a Year von
Zero to Automated in Under a YearZero to Automated in Under a Year
Zero to Automated in Under a YearNetwork Automation Forum
15 views23 Folien
Design Driven Network Assurance von
Design Driven Network AssuranceDesign Driven Network Assurance
Design Driven Network AssuranceNetwork Automation Forum
15 views42 Folien
ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ... von
ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ...ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ...
ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ...Jasper Oosterveld
18 views49 Folien
Voice Logger - Telephony Integration Solution at Aegis von
Voice Logger - Telephony Integration Solution at AegisVoice Logger - Telephony Integration Solution at Aegis
Voice Logger - Telephony Integration Solution at AegisNirmal Sharma
39 views1 Folie
Mini-Track: Challenges to Network Automation Adoption von
Mini-Track: Challenges to Network Automation AdoptionMini-Track: Challenges to Network Automation Adoption
Mini-Track: Challenges to Network Automation AdoptionNetwork Automation Forum
12 views27 Folien

Último(20)

ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ... von Jasper Oosterveld
ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ...ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ...
ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ...
Voice Logger - Telephony Integration Solution at Aegis von Nirmal Sharma
Voice Logger - Telephony Integration Solution at AegisVoice Logger - Telephony Integration Solution at Aegis
Voice Logger - Telephony Integration Solution at Aegis
Nirmal Sharma39 views
Piloting & Scaling Successfully With Microsoft Viva von Richard Harbridge
Piloting & Scaling Successfully With Microsoft VivaPiloting & Scaling Successfully With Microsoft Viva
Piloting & Scaling Successfully With Microsoft Viva
Attacking IoT Devices from a Web Perspective - Linux Day von Simone Onofri
Attacking IoT Devices from a Web Perspective - Linux Day Attacking IoT Devices from a Web Perspective - Linux Day
Attacking IoT Devices from a Web Perspective - Linux Day
Simone Onofri16 views
STKI Israeli Market Study 2023 corrected forecast 2023_24 v3.pdf von Dr. Jimmy Schwarzkopf
STKI Israeli Market Study 2023   corrected forecast 2023_24 v3.pdfSTKI Israeli Market Study 2023   corrected forecast 2023_24 v3.pdf
STKI Israeli Market Study 2023 corrected forecast 2023_24 v3.pdf
Serverless computing with Google Cloud (2023-24) von wesley chun
Serverless computing with Google Cloud (2023-24)Serverless computing with Google Cloud (2023-24)
Serverless computing with Google Cloud (2023-24)
wesley chun11 views
STPI OctaNE CoE Brochure.pdf von madhurjyapb
STPI OctaNE CoE Brochure.pdfSTPI OctaNE CoE Brochure.pdf
STPI OctaNE CoE Brochure.pdf
madhurjyapb14 views
The details of description: Techniques, tips, and tangents on alternative tex... von BookNet Canada
The details of description: Techniques, tips, and tangents on alternative tex...The details of description: Techniques, tips, and tangents on alternative tex...
The details of description: Techniques, tips, and tangents on alternative tex...
BookNet Canada127 views
Empathic Computing: Delivering the Potential of the Metaverse von Mark Billinghurst
Empathic Computing: Delivering  the Potential of the MetaverseEmpathic Computing: Delivering  the Potential of the Metaverse
Empathic Computing: Delivering the Potential of the Metaverse
Mark Billinghurst478 views

Finding your way with Sass+Compass

  • 1. finding your way with sass+compass ben@cornershopcreative.com
  • 2. WHAT IS SASS? Sass is a CSS Pre-processor or meta-language Sass is a “competitor” to LESS and Stylus Sass is written in Ruby Sass is pretty cool
  • 3. WHAT IS COMPASS? Compass is an open-source library of Sass mixins. Compass is a CSS authoring framework. Compass is what makes Sass really, really useful.
  • 4. WHAT SASS DOES Introduces new things to CSS: • nested rules • variables • mixins • inheritance • and much more!
  • 5. GETTING GOING in your development environment* * you don’t need sass on prod!
  • 6. STEP BY STEP 1.Install ruby (I use rvm) $ curl -L https://get.rvm.io | bash -s stable --ruby 2.Install the compass “gem” $ gem update --system $ gem install compass 3.Install compass-normalize (optional) $ gem install compass-normalize 4.Confirm installation $ compass version
  • 7. STEP BY STEP 5. Set up a project! $ compass create <foldername> ...or... $ compass install compass --syntax sass live demo time!
  • 9. TWO SYNTAXES SCSS SASS .selector { .selector color: green; color: green border:1px solid $black; border:1px solid $black @include inline-block; +inline-block li { li display: block; display: block font: font: family: $sans; family: $sans size: 122%; size: 122% } @extend .navitem } .other-selector .other-selector {}
  • 10. THE PROCESS 1.Write your Sass 2.Compile your Sass into CSS 3.Include your CSS on prod 4.Bask in glory
  • 11. LET’S TRY IT showing is better than telling, right?
  • 12. WE JUST COVERED Compiling Sass files with compass watch and compass compile Using @imports and underscores to control our content Mucking with config.rb
  • 13. VARIABLES & MIXINS and some math, just for fun!
  • 14. VARIABLES $sans: “Helvetica Neue”, Helvetica, Arial, sans-serif $display: “Lobster”, Impact, serif $tiny: Verdana, sans-serif $evil: Comic Sans, sans-serif $where: left $radius: 5px $base: 14px $dark: #222 $light: #fff $seethru: rgba($light, 0.2) $grey: $dark + #444 //or lighten($dark, 40%) $red: #971219 doing this in _variables.sass is a good idea
  • 15. VARIABLES IN ACTION! .redtext color: $red article font: family: $sans size: $base color: $dark background-color: $seethru h1 font: #{$base * 2}/#{$base * 2.2} $display @extend .redtext &.title text-transform: uppercase .#{$where}-rail width: 200px
  • 16. MIXINS =notext overflow: hidden white-space: nowrap text-indent: 105% text-align: left =float( $dir: left ) float: $dir @if $dir == left margin: 0 10px 5px 0 @else margin: 0 0 5px 10px .alignleft +float(right)
  • 17. ENTER COMPASS mixin magic and more
  • 18. CROSS-BROWSER STUFF +opacity(0.6) filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=60); opacity: 0.6; +inline-block display: -moz-inline-stack; display: inline-block; vertical-align: middle; *vertical-align: auto; zoom: 1; *display: inline;
  • 19. MOAR CROSS-BROWSER +opacity(0.6) +clearfix +legacy-pie-clearfix +text-shadow(1px 2px 8px rgba(black, 0.3)) +box-shadow(inset 2px 4px 10px $red) +border-radius(8px) +box-sizing(border-box)
  • 20. FANCY CSS3 = EASY! +single-transition(all, 0.3s, ease) +rotate(20deg) +scale(1.2) +background-image(linear-gradient(top, $red, $red - #222)) http://compass-style.org/reference
  • 22. THE PROCESS 1.Create a sub-directory in /images/ 2.Save your sprite png’s in there 3.Tell Compass to create classes 4.Celebrate
  • 23. EXAMPLE // gives us .mysprites-[filename] @import "mysprites/*.png" $mysprites-sprite-dimensions: true //sets dimensions +all-mysprites-sprites /* so if images/mysprites/logo.png is 200x100, then... .mysprites-logo width: 200px; height: 100px; background: url(images/mysprites-3434034734.png) no-repeat; background-position: [whatever] [whatever]; */ h1#logo @extend .mysprites-logo
  • 24. OTHER STUFF random other tricks
  • 25. WELL THAT’S HANDY h1 font-size: 40px @media screen and (max-width: $break-small) font-size: 30px a.heading background-image: image-url(‘filename.jpg’) &:hover +scale(1.1) .no-csstransforms &:hover text-decoration: underline $fullwidth: 960px .rail width: percentage(220px/$fullwidth) margin: percentage(10px/$fullwidth)
  • 26. FOR MORE... http://sass-lang.com http://compass-style.org http://www.kaelig.fr/bettersassdocs/ http://thesassway.com
  • 27. CONNECT Ben Byrne ben@cornershopcreative.com facebook.com/drywall Twitter: @drywall