SlideShare a Scribd company logo
1 of 52
Download to read offline
Intro to CSS Extenders:

SASS

LESS

Bonus: Compass Framework


PyWeb-IL #22 / 27 Dec 2010   http://flic.kr/p/768ooD
This frontend dude maintains…

a production site with lots of CSS

a heavy drinking habit

a growing hatred for humanity




                                     http://flic.kr/p/5cCATU
CSS can be annoying.
Here are some workarounds
   that might make you


    SMILE
CSS ANNOYANCES
     variables

    class mixins

    rule nesting

       math
CSS Extenders
CSS Preprocessors is a crappy name.
srsly? at pyweb?
  (please don’t shoot me)
SASS          LESS
sass-lang.com   lesscss.org
CleverCSS
very similar • not as mature • not actively developed
variables      variables
class mixins   class mixins
rule nesting   rule nesting
   math           math
DSL is for
                       losers.




CleverCSS     SASS                 LESS




        DSL          CSS Superset
Yeah, um,
              what he said…




CleverCSS                      SASS     LESS
                              (.scss)



        DSL                   CSS Superset
INSTALLING
gem install haml   gem install less

     .scss              .less

    DSL: .sass
VARIABLES & OPERATIONS
$mycolor: #ddeeff;                  @mycolor: #ddeeff;
$myborder: 3px;                    @myborder: 3px;

#mynav {                           #mynav {
  background-color: $mycolor;        background-color: @mycolor;
  color: $mycolor + #111;            color: @mycolor + #111;
}                                  }

.hasborder {                       .hasborder {
  border: $myborder solid black;     border: @myborder solid black;
  padding: $myborder * 4;            padding: @myborder * 4;
}                                  }
Basic Color Math       Basic Color Math
  $mycolor + #111        @mycolor + #111

 Fancy color functions
lighten($mycolor, 20%)

  Advantage: SASS
MIXINS
@mixin sidebar {            .sidebar {
  font-size: 14px;             font-size: 14px;
  background-color: #ddd;      background-color: #ddd;
  width: 100px;                width: 100px
}                           }

.sidebar_right {            .sidebar_right {
   @include sidebar;           .sidebar;
   float: right;                float: right;
}                           }

.sidebar_left {             .sidebar_left {
   @include sidebar;           .sidebar;
   float: left;                 float: left;
}                           }
@mixin sidebar($width: 100px) {   .sidebar(@width: 100px) {
  font-size: 14px;                   font-size: 14px;
  background-color: #ddd;            background-color: #ddd;
  width: $width;                     width: @width;
}                                 }

.sidebar_right {                  .sidebar_right {
   @include sidebar;                 .sidebar;
   float: right;                      float: right;
}                                 }

.sidebar_right_wide {             .sidebar_right_wide {
   @include sidebar(150px);          .sidebar(150px);
   float: right;                      float: right;
}                                 }
NESTED RULES
#header {
  color: green;
}

#header a {
  text-decoration: none;
  color: red;
}
#header
#header a
#header ul
#header ul li
#header ul li strong
#content a
#content ul
…
#FML
#header {                    #header {
  color: green;                color: green;
  a{                           a{
    text-decoration: none;       text-decoration: none;
    color: red;                  color: red;
  }                            }
  a.special {                  a.special {
    font-weight: bold;           font-weight: bold;
    color: blue;                 color: blue;
  }                            }
}                            }
#header {
  color: green;
  border: {
    width: 1px;
    color: black;
    style: solid;
  }
}




                    ?
INHERITANCE
.error {
   color: red;
}

.error.severe {
   @extend .error;
   font-weight: bold;
}




                   ?
INCLUDES
/* _mysnippet.scss */   /* mysnippet.less */
…                       …

/* style.scss */        /* style.less */
@import “mysnippet”     @import “mysnippet”
Rope!
enough for you to hang yourself with.
USAGE & DEPLOYMENT
sass style.scss:style.css     lessc style.less

sass srcdir/sass:srcdir/css
sass style.scss:style.css             lessc style.less

sass srcdir/sass:srcdir/css


sass --watch style.scss:style.css     lessc style.less --watch

sass --watch srcdir/sass:srcdir/css
More functionality      Less functionality

More documentation     Less documentation

Took ideas from LESS   Took ideas from SASS

  Core is the same       Core is the same
More functionality      Less functionality

More documentation     Less documentation

Took ideas from LESS   Took ideas from SASS

  Core is the same       Core is the same
A CSS Authoring Framework
      based on SASS
       http://compass-style.org
       but really, you should see
     http://beta.compass-style.org
Like Django for CSS
extensible, best-practice implementations
     that you don’t need to reinvent
Installing
     gem install compass
compass create /path/to/project
_BASE.SCSS
$brand_color: #acd29f;
$base_font_size: 16px;

@import “compass/reset”;
@import “compass/utilities”;

…
MYAPP.CSS
@import “base”;

/* your sassy styles go here. */
DEJA VU?
{% extends “base.html” %}

<!-- your markup goes here. -->
END PRESENTATIONAL MARKUP

<body id=“blog-detail”>
   <article class=“wrap”>
      <header class=“grid-12”>…</header>
      <div class=“grid-8” id=“content”>…</div>
      <aside class=“grid-4” id>…</aside>
      <footer class=“grid-12”>…</footer>
   </article>
</body>
END PRESENTATIONAL MARKUP

@import “blueprint”

@mixin two-column {
  /* two-col layout on a 12-col grid */
  article {
      @include container;
      header, footer { @include column(12); }
      aside { @include column(4); }
      .content { @include column(8); }
  }
}

body#blog-detail,
body#blog-list { @include two-column; }
END PRESENTATIONAL MARKUP
 <body id=“blog-detail”>
    <article class=“wrap”>
       <header class=“grid-12”>…</header>
       <div class=“grid-8” id=“content”>…</div>
       <aside class=“grid-4” id>…</aside>
       <footer class=“grid-12”>…</footer>
    </article>
 </body>

 <body id=“blog-detail”>
    <article>
       <header>…</header>
       <div id=“content”>…</div>
       <aside>…</aside>
       <footer>…</footer>
    </article>
 </body>
COST: LARGER CSS
Generated CSS

body#blog-detail article { /* wrap styles copied here */ }

body#blog-detail article header,
body#blog-detail article footer { /* grid-12 styles copied here */}

body #blog-detail article aside { /* grid-4 styles copied here */ }
VENDOR PREFIX HELL
@import “compass/css3”
.alert {
    background-color: red;
    @include border-radius(4px)
}
VENDOR PREFIX HELL
.alert {
    background-color: red;
    -webkit-border-radius: 4px;
    -moz-border-radius: 4px;
    -o-border-radius: 4px;
    -ms-border-radius: 4px;
    -khtml-border-radius: 4px;
    border-radius: 4px;
}
SAME POWERFUL TECHNIQUES,
        NEW LOW PRICE

  cross-browser hacks and fixes

  shortcuts around verbose CSS

pre-baked layout (ex: sticky footer)

              spriting

           extensions!
DEPLOYMENT
I still haven’t completely figured this out.

    Trigger compilation from Fabric.

                 Bonus:

  sass --style compressed infile:outfile
Power
            complexity
can’t use fancy GUI editors (SASS)
        toolchain addition

      Still pretty awesome.
Questions?
Thank you!
  @idangazit

More Related Content

What's hot

Preprocessor presentation
Preprocessor presentationPreprocessor presentation
Preprocessor presentationMario Noble
 
Simplifying CSS With Sass
Simplifying CSS With SassSimplifying CSS With Sass
Simplifying CSS With SassThomas Reynolds
 
Deep dive into sass
Deep dive into sassDeep dive into sass
Deep dive into sassKnoldus Inc.
 
Organizing & Simplifying CSS [with Sass]
Organizing & Simplifying CSS [with Sass]Organizing & Simplifying CSS [with Sass]
Organizing & Simplifying CSS [with Sass]Matt Puchlerz
 
CSS Preprocessors: LESS is more or look SASS-y trying
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
 
Bringing sexy back to CSS: SASS/SCSS, LESS and Compass
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
 
HTML5, CSS, JavaScript Style guide and coding conventions
HTML5, CSS, JavaScript Style guide and coding conventionsHTML5, CSS, JavaScript Style guide and coding conventions
HTML5, CSS, JavaScript Style guide and coding conventionsKnoldus Inc.
 
Introduction to SASS
Introduction to SASSIntroduction to SASS
Introduction to SASSJon Dean
 
CSS 開發加速指南-Sass & Compass
CSS 開發加速指南-Sass & CompassCSS 開發加速指南-Sass & Compass
CSS 開發加速指南-Sass & CompassLucien Lee
 
McrFRED 39 | CSS Processors
McrFRED 39 | CSS ProcessorsMcrFRED 39 | CSS Processors
McrFRED 39 | CSS ProcessorsTristan Ashley
 
Write LESS. DO more.
Write LESS. DO more.Write LESS. DO more.
Write LESS. DO more.Eugene Nor
 
Managing responsive websites with css preprocessors.
Managing responsive websites with css preprocessors. Managing responsive websites with css preprocessors.
Managing responsive websites with css preprocessors. The University of Akron
 
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)
Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)Adam Darowski
 
An Introduction to CSS Preprocessors (SASS & LESS)
An Introduction to CSS Preprocessors (SASS & LESS)An Introduction to CSS Preprocessors (SASS & LESS)
An Introduction to CSS Preprocessors (SASS & LESS)Folio3 Software
 
Wrangling the CSS Beast with Sass
Wrangling the CSS Beast  with SassWrangling the CSS Beast  with Sass
Wrangling the CSS Beast with SassRob Friesel
 
Simple introduction Sass
Simple introduction SassSimple introduction Sass
Simple introduction SassZeeshan Ahmed
 
From PSD to WordPress Theme: Bringing designs to life
From PSD to WordPress Theme: Bringing designs to lifeFrom PSD to WordPress Theme: Bringing designs to life
From PSD to WordPress Theme: Bringing designs to lifeDerek Christensen
 
Advanced Technology for Web Application Design
Advanced Technology for Web Application DesignAdvanced Technology for Web Application Design
Advanced Technology for Web Application DesignBryce Kerley
 

What's hot (20)

Preprocessor presentation
Preprocessor presentationPreprocessor presentation
Preprocessor presentation
 
Simplifying CSS With Sass
Simplifying CSS With SassSimplifying CSS With Sass
Simplifying CSS With Sass
 
Deep dive into sass
Deep dive into sassDeep dive into sass
Deep dive into sass
 
Organizing & Simplifying CSS [with Sass]
Organizing & Simplifying CSS [with Sass]Organizing & Simplifying CSS [with Sass]
Organizing & Simplifying CSS [with Sass]
 
CSS Preprocessors: LESS is more or look SASS-y trying
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 trying
 
Bringing sexy back to CSS: SASS/SCSS, LESS and Compass
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 Compass
 
Css frameworks
Css frameworksCss frameworks
Css frameworks
 
HTML5, CSS, JavaScript Style guide and coding conventions
HTML5, CSS, JavaScript Style guide and coding conventionsHTML5, CSS, JavaScript Style guide and coding conventions
HTML5, CSS, JavaScript Style guide and coding conventions
 
Introduction to SASS
Introduction to SASSIntroduction to SASS
Introduction to SASS
 
CSS 開發加速指南-Sass & Compass
CSS 開發加速指南-Sass & CompassCSS 開發加速指南-Sass & Compass
CSS 開發加速指南-Sass & Compass
 
McrFRED 39 | CSS Processors
McrFRED 39 | CSS ProcessorsMcrFRED 39 | CSS Processors
McrFRED 39 | CSS Processors
 
Write LESS. DO more.
Write LESS. DO more.Write LESS. DO more.
Write LESS. DO more.
 
Managing responsive websites with css preprocessors.
Managing responsive websites with css preprocessors. Managing responsive websites with css preprocessors.
Managing responsive websites with css preprocessors.
 
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)
Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)
 
An Introduction to CSS Preprocessors (SASS & LESS)
An Introduction to CSS Preprocessors (SASS & LESS)An Introduction to CSS Preprocessors (SASS & LESS)
An Introduction to CSS Preprocessors (SASS & LESS)
 
Wrangling the CSS Beast with Sass
Wrangling the CSS Beast  with SassWrangling the CSS Beast  with Sass
Wrangling the CSS Beast with Sass
 
Simple introduction Sass
Simple introduction SassSimple introduction Sass
Simple introduction Sass
 
From PSD to WordPress Theme: Bringing designs to life
From PSD to WordPress Theme: Bringing designs to lifeFrom PSD to WordPress Theme: Bringing designs to life
From PSD to WordPress Theme: Bringing designs to life
 
Advanced Technology for Web Application Design
Advanced Technology for Web Application DesignAdvanced Technology for Web Application Design
Advanced Technology for Web Application Design
 
Compass/Sass
Compass/SassCompass/Sass
Compass/Sass
 

Viewers also liked

A Little Graph Theory for the Busy Developer - Jim Webber @ GraphConnect Chic...
A Little Graph Theory for the Busy Developer - Jim Webber @ GraphConnect Chic...A Little Graph Theory for the Busy Developer - Jim Webber @ GraphConnect Chic...
A Little Graph Theory for the Busy Developer - Jim Webber @ GraphConnect Chic...Neo4j
 
The Strength of Indirect Relations in Social Networks
The Strength of Indirect Relations in Social NetworksThe Strength of Indirect Relations in Social Networks
The Strength of Indirect Relations in Social Networksmosabou
 
Graph databases in computational bioloby: case of neo4j and TitanDB
Graph databases in computational bioloby: case of neo4j and TitanDBGraph databases in computational bioloby: case of neo4j and TitanDB
Graph databases in computational bioloby: case of neo4j and TitanDBAndrei KUCHARAVY
 
How To Interact With Your Front End Developer
How To Interact With Your Front End DeveloperHow To Interact With Your Front End Developer
How To Interact With Your Front End DeveloperAll Things Open
 
FluxGraph: a time-machine for your graphs
FluxGraph: a time-machine for your graphsFluxGraph: a time-machine for your graphs
FluxGraph: a time-machine for your graphsdatablend
 
Neo4j - 5 cool graph examples
Neo4j - 5 cool graph examplesNeo4j - 5 cool graph examples
Neo4j - 5 cool graph examplesPeter Neubauer
 
Applications of Linear Algebra in Computer Sciences
Applications of Linear Algebra in Computer SciencesApplications of Linear Algebra in Computer Sciences
Applications of Linear Algebra in Computer SciencesAmir Sharif Chishti
 
Data Modeling with Neo4j
Data Modeling with Neo4jData Modeling with Neo4j
Data Modeling with Neo4jNeo4j
 

Viewers also liked (10)

A Little Graph Theory for the Busy Developer - Jim Webber @ GraphConnect Chic...
A Little Graph Theory for the Busy Developer - Jim Webber @ GraphConnect Chic...A Little Graph Theory for the Busy Developer - Jim Webber @ GraphConnect Chic...
A Little Graph Theory for the Busy Developer - Jim Webber @ GraphConnect Chic...
 
The Strength of Indirect Relations in Social Networks
The Strength of Indirect Relations in Social NetworksThe Strength of Indirect Relations in Social Networks
The Strength of Indirect Relations in Social Networks
 
Graph databases in computational bioloby: case of neo4j and TitanDB
Graph databases in computational bioloby: case of neo4j and TitanDBGraph databases in computational bioloby: case of neo4j and TitanDB
Graph databases in computational bioloby: case of neo4j and TitanDB
 
How To Interact With Your Front End Developer
How To Interact With Your Front End DeveloperHow To Interact With Your Front End Developer
How To Interact With Your Front End Developer
 
FluxGraph: a time-machine for your graphs
FluxGraph: a time-machine for your graphsFluxGraph: a time-machine for your graphs
FluxGraph: a time-machine for your graphs
 
Neo4j and bioinformatics
Neo4j and bioinformaticsNeo4j and bioinformatics
Neo4j and bioinformatics
 
Less is beautiful
Less is beautifulLess is beautiful
Less is beautiful
 
Neo4j - 5 cool graph examples
Neo4j - 5 cool graph examplesNeo4j - 5 cool graph examples
Neo4j - 5 cool graph examples
 
Applications of Linear Algebra in Computer Sciences
Applications of Linear Algebra in Computer SciencesApplications of Linear Algebra in Computer Sciences
Applications of Linear Algebra in Computer Sciences
 
Data Modeling with Neo4j
Data Modeling with Neo4jData Modeling with Neo4j
Data Modeling with Neo4j
 

Similar to CSS Extenders

Software programming tools for creating/managing CSS files
Software programming tools for creating/managing CSS filesSoftware programming tools for creating/managing CSS files
Software programming tools for creating/managing CSS filesDinu Suman
 
Getting Started with Sass & Compass
Getting Started with Sass & CompassGetting Started with Sass & Compass
Getting Started with Sass & CompassRob Davarnia
 
Sass - Making CSS fun again.
Sass - Making CSS fun again.Sass - Making CSS fun again.
Sass - Making CSS fun again.Gabriel Neutzling
 
Sass and Compass - Getting Started
Sass and Compass - Getting StartedSass and Compass - Getting Started
Sass and Compass - Getting Startededgincvg
 
Work and play with SASS & Compass
Work and play with SASS & CompassWork and play with SASS & Compass
Work and play with SASS & CompassAndreas Dantz
 
Using Sass - Building on CSS
Using Sass - Building on CSSUsing Sass - Building on CSS
Using Sass - Building on CSSSayanee Basu
 
Pacific Northwest Drupal Summit: Basic & SASS
Pacific Northwest Drupal Summit: Basic & SASSPacific Northwest Drupal Summit: Basic & SASS
Pacific Northwest Drupal Summit: Basic & SASSSteve Krueger
 
Doing More With Less
Doing More With LessDoing More With Less
Doing More With LessDavid Engel
 
SASS, Compass, Gulp, Greensock
SASS, Compass, Gulp, GreensockSASS, Compass, Gulp, Greensock
SASS, Compass, Gulp, GreensockMarco Pinheiro
 
Raleigh Web Design Meetup Group - Sass Presentation
Raleigh Web Design Meetup Group - Sass PresentationRaleigh Web Design Meetup Group - Sass Presentation
Raleigh Web Design Meetup Group - Sass PresentationDaniel Yuschick
 
Learn Sass and Compass quick
Learn Sass and Compass quickLearn Sass and Compass quick
Learn Sass and Compass quickBilly Shih
 
CSS Less framework overview, Pros and Cons
CSS Less framework overview, Pros and ConsCSS Less framework overview, Pros and Cons
CSS Less framework overview, Pros and ConsSanjoy Kr. Paul
 
Big Design Conference: CSS3
Big Design Conference: CSS3 Big Design Conference: CSS3
Big Design Conference: CSS3 Wynn Netherland
 
CSS with LESS for #jd13nl
CSS with LESS for #jd13nlCSS with LESS for #jd13nl
CSS with LESS for #jd13nlHans Kuijpers
 

Similar to CSS Extenders (20)

Less css
Less cssLess css
Less css
 
Software programming tools for creating/managing CSS files
Software programming tools for creating/managing CSS filesSoftware programming tools for creating/managing CSS files
Software programming tools for creating/managing CSS files
 
Getting Started with Sass & Compass
Getting Started with Sass & CompassGetting Started with Sass & Compass
Getting Started with Sass & Compass
 
Sass - Making CSS fun again.
Sass - Making CSS fun again.Sass - Making CSS fun again.
Sass - Making CSS fun again.
 
Sass and Compass - Getting Started
Sass and Compass - Getting StartedSass and Compass - Getting Started
Sass and Compass - Getting Started
 
Work and play with SASS & Compass
Work and play with SASS & CompassWork and play with SASS & Compass
Work and play with SASS & Compass
 
Using Sass - Building on CSS
Using Sass - Building on CSSUsing Sass - Building on CSS
Using Sass - Building on CSS
 
FCIP SASS Talk
FCIP SASS TalkFCIP SASS Talk
FCIP SASS Talk
 
Pacific Northwest Drupal Summit: Basic & SASS
Pacific Northwest Drupal Summit: Basic & SASSPacific Northwest Drupal Summit: Basic & SASS
Pacific Northwest Drupal Summit: Basic & SASS
 
Why less?
Why less?Why less?
Why less?
 
Doing More With Less
Doing More With LessDoing More With Less
Doing More With Less
 
Less & Sass
Less & SassLess & Sass
Less & Sass
 
SASS, Compass, Gulp, Greensock
SASS, Compass, Gulp, GreensockSASS, Compass, Gulp, Greensock
SASS, Compass, Gulp, Greensock
 
Raleigh Web Design Meetup Group - Sass Presentation
Raleigh Web Design Meetup Group - Sass PresentationRaleigh Web Design Meetup Group - Sass Presentation
Raleigh Web Design Meetup Group - Sass Presentation
 
A better CSS: Sass and Less - CC FE & UX
A better CSS: Sass and Less - CC FE & UXA better CSS: Sass and Less - CC FE & UX
A better CSS: Sass and Less - CC FE & UX
 
Learn Sass and Compass quick
Learn Sass and Compass quickLearn Sass and Compass quick
Learn Sass and Compass quick
 
CSS Less framework overview, Pros and Cons
CSS Less framework overview, Pros and ConsCSS Less framework overview, Pros and Cons
CSS Less framework overview, Pros and Cons
 
Sass&compass
Sass&compassSass&compass
Sass&compass
 
Big Design Conference: CSS3
Big Design Conference: CSS3 Big Design Conference: CSS3
Big Design Conference: CSS3
 
CSS with LESS for #jd13nl
CSS with LESS for #jd13nlCSS with LESS for #jd13nl
CSS with LESS for #jd13nl
 

More from Idan Gazit

Datadesignmeaning
DatadesignmeaningDatadesignmeaning
DatadesignmeaningIdan Gazit
 
Designers Make It Go to Eleven!
Designers Make It Go to Eleven!Designers Make It Go to Eleven!
Designers Make It Go to Eleven!Idan Gazit
 
Web typography
Web typographyWeb typography
Web typographyIdan Gazit
 
CSS for Designers
CSS for DesignersCSS for Designers
CSS for DesignersIdan Gazit
 
CSS for Designers
CSS for DesignersCSS for Designers
CSS for DesignersIdan Gazit
 
CSS: selectors and the box model
CSS: selectors and the box modelCSS: selectors and the box model
CSS: selectors and the box modelIdan Gazit
 
CSS: selectors and the box model
CSS: selectors and the box modelCSS: selectors and the box model
CSS: selectors and the box modelIdan Gazit
 
Repeatable Deployments and Installations
Repeatable Deployments and InstallationsRepeatable Deployments and Installations
Repeatable Deployments and InstallationsIdan Gazit
 
An Introduction to Celery
An Introduction to CeleryAn Introduction to Celery
An Introduction to CeleryIdan Gazit
 
Django 1.1 Tour
Django 1.1 TourDjango 1.1 Tour
Django 1.1 TourIdan Gazit
 

More from Idan Gazit (11)

Datadesignmeaning
DatadesignmeaningDatadesignmeaning
Datadesignmeaning
 
Designers Make It Go to Eleven!
Designers Make It Go to Eleven!Designers Make It Go to Eleven!
Designers Make It Go to Eleven!
 
Web typography
Web typographyWeb typography
Web typography
 
CSS for Designers
CSS for DesignersCSS for Designers
CSS for Designers
 
CSS for Designers
CSS for DesignersCSS for Designers
CSS for Designers
 
CSS: selectors and the box model
CSS: selectors and the box modelCSS: selectors and the box model
CSS: selectors and the box model
 
CSS: selectors and the box model
CSS: selectors and the box modelCSS: selectors and the box model
CSS: selectors and the box model
 
Why Django
Why DjangoWhy Django
Why Django
 
Repeatable Deployments and Installations
Repeatable Deployments and InstallationsRepeatable Deployments and Installations
Repeatable Deployments and Installations
 
An Introduction to Celery
An Introduction to CeleryAn Introduction to Celery
An Introduction to Celery
 
Django 1.1 Tour
Django 1.1 TourDjango 1.1 Tour
Django 1.1 Tour
 

Recently uploaded

call girls in candolim beach 9870370636] NORTH GOA ..
call girls in candolim beach 9870370636] NORTH GOA ..call girls in candolim beach 9870370636] NORTH GOA ..
call girls in candolim beach 9870370636] NORTH GOA ..nishakur201
 
CALL ON ➥8923113531 🔝Call Girls Mahanagar Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Mahanagar Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Mahanagar Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Mahanagar Lucknow best sexual serviceanilsa9823
 
办理国外毕业证学位证《原版美国montana文凭》蒙大拿州立大学毕业证制作成绩单修改
办理国外毕业证学位证《原版美国montana文凭》蒙大拿州立大学毕业证制作成绩单修改办理国外毕业证学位证《原版美国montana文凭》蒙大拿州立大学毕业证制作成绩单修改
办理国外毕业证学位证《原版美国montana文凭》蒙大拿州立大学毕业证制作成绩单修改atducpo
 
Reinventing Corporate Philanthropy_ Strategies for Meaningful Impact by Leko ...
Reinventing Corporate Philanthropy_ Strategies for Meaningful Impact by Leko ...Reinventing Corporate Philanthropy_ Strategies for Meaningful Impact by Leko ...
Reinventing Corporate Philanthropy_ Strategies for Meaningful Impact by Leko ...Leko Durda
 
Lucknow 💋 High Class Call Girls Lucknow 10k @ I'm VIP Independent Escorts Gir...
Lucknow 💋 High Class Call Girls Lucknow 10k @ I'm VIP Independent Escorts Gir...Lucknow 💋 High Class Call Girls Lucknow 10k @ I'm VIP Independent Escorts Gir...
Lucknow 💋 High Class Call Girls Lucknow 10k @ I'm VIP Independent Escorts Gir...anilsa9823
 
The Selfspace Journal Preview by Mindbrush
The Selfspace Journal Preview by MindbrushThe Selfspace Journal Preview by Mindbrush
The Selfspace Journal Preview by MindbrushShivain97
 
Call Girls in Kalyan Vihar Delhi 💯 Call Us 🔝8264348440🔝
Call Girls in Kalyan Vihar Delhi 💯 Call Us 🔝8264348440🔝Call Girls in Kalyan Vihar Delhi 💯 Call Us 🔝8264348440🔝
Call Girls in Kalyan Vihar Delhi 💯 Call Us 🔝8264348440🔝soniya singh
 
Top Rated Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
Understanding Relationship Anarchy: A Guide to Liberating Love | CIO Women Ma...
Understanding Relationship Anarchy: A Guide to Liberating Love | CIO Women Ma...Understanding Relationship Anarchy: A Guide to Liberating Love | CIO Women Ma...
Understanding Relationship Anarchy: A Guide to Liberating Love | CIO Women Ma...CIOWomenMagazine
 
Lilac Illustrated Social Psychology Presentation.pptx
Lilac Illustrated Social Psychology Presentation.pptxLilac Illustrated Social Psychology Presentation.pptx
Lilac Illustrated Social Psychology Presentation.pptxABMWeaklings
 
REFLECTIONS Newsletter Jan-Jul 2024.pdf.pdf
REFLECTIONS Newsletter Jan-Jul 2024.pdf.pdfREFLECTIONS Newsletter Jan-Jul 2024.pdf.pdf
REFLECTIONS Newsletter Jan-Jul 2024.pdf.pdfssusere8ea60
 
Call Girls In Andheri East Call US Pooja📞 9892124323 Book Hot And
Call Girls In Andheri East Call US Pooja📞 9892124323 Book Hot AndCall Girls In Andheri East Call US Pooja📞 9892124323 Book Hot And
Call Girls In Andheri East Call US Pooja📞 9892124323 Book Hot AndPooja Nehwal
 
文凭办理《原版美国USU学位证书》犹他州立大学毕业证制作成绩单修改
文凭办理《原版美国USU学位证书》犹他州立大学毕业证制作成绩单修改文凭办理《原版美国USU学位证书》犹他州立大学毕业证制作成绩单修改
文凭办理《原版美国USU学位证书》犹他州立大学毕业证制作成绩单修改atducpo
 
Dhule Call Girls #9907093804 Contact Number Escorts Service Dhule
Dhule Call Girls #9907093804 Contact Number Escorts Service DhuleDhule Call Girls #9907093804 Contact Number Escorts Service Dhule
Dhule Call Girls #9907093804 Contact Number Escorts Service Dhulesrsj9000
 
办理西悉尼大学毕业证成绩单、制作假文凭
办理西悉尼大学毕业证成绩单、制作假文凭办理西悉尼大学毕业证成绩单、制作假文凭
办理西悉尼大学毕业证成绩单、制作假文凭o8wvnojp
 
《塔夫斯大学毕业证成绩单购买》做Tufts文凭毕业证成绩单/伪造美国假文凭假毕业证书图片Q微信741003700《塔夫斯大学毕业证购买》《Tufts毕业文...
《塔夫斯大学毕业证成绩单购买》做Tufts文凭毕业证成绩单/伪造美国假文凭假毕业证书图片Q微信741003700《塔夫斯大学毕业证购买》《Tufts毕业文...《塔夫斯大学毕业证成绩单购买》做Tufts文凭毕业证成绩单/伪造美国假文凭假毕业证书图片Q微信741003700《塔夫斯大学毕业证购买》《Tufts毕业文...
《塔夫斯大学毕业证成绩单购买》做Tufts文凭毕业证成绩单/伪造美国假文凭假毕业证书图片Q微信741003700《塔夫斯大学毕业证购买》《Tufts毕业文...ur8mqw8e
 
Breath, Brain & Beyond_A Holistic Approach to Peak Performance.pdf
Breath, Brain & Beyond_A Holistic Approach to Peak Performance.pdfBreath, Brain & Beyond_A Holistic Approach to Peak Performance.pdf
Breath, Brain & Beyond_A Holistic Approach to Peak Performance.pdfJess Walker
 
Call Girls Anjuna beach Mariott Resort ₰8588052666
Call Girls Anjuna beach Mariott Resort ₰8588052666Call Girls Anjuna beach Mariott Resort ₰8588052666
Call Girls Anjuna beach Mariott Resort ₰8588052666nishakur201
 
CALL ON ➥8923113531 🔝Call Girls Adil Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Adil Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Adil Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Adil Nagar Lucknow best Female serviceanilsa9823
 

Recently uploaded (20)

call girls in candolim beach 9870370636] NORTH GOA ..
call girls in candolim beach 9870370636] NORTH GOA ..call girls in candolim beach 9870370636] NORTH GOA ..
call girls in candolim beach 9870370636] NORTH GOA ..
 
CALL ON ➥8923113531 🔝Call Girls Mahanagar Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Mahanagar Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Mahanagar Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Mahanagar Lucknow best sexual service
 
办理国外毕业证学位证《原版美国montana文凭》蒙大拿州立大学毕业证制作成绩单修改
办理国外毕业证学位证《原版美国montana文凭》蒙大拿州立大学毕业证制作成绩单修改办理国外毕业证学位证《原版美国montana文凭》蒙大拿州立大学毕业证制作成绩单修改
办理国外毕业证学位证《原版美国montana文凭》蒙大拿州立大学毕业证制作成绩单修改
 
Model Call Girl in Lado Sarai Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Lado Sarai Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Lado Sarai Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Lado Sarai Delhi reach out to us at 🔝9953056974🔝
 
Reinventing Corporate Philanthropy_ Strategies for Meaningful Impact by Leko ...
Reinventing Corporate Philanthropy_ Strategies for Meaningful Impact by Leko ...Reinventing Corporate Philanthropy_ Strategies for Meaningful Impact by Leko ...
Reinventing Corporate Philanthropy_ Strategies for Meaningful Impact by Leko ...
 
Lucknow 💋 High Class Call Girls Lucknow 10k @ I'm VIP Independent Escorts Gir...
Lucknow 💋 High Class Call Girls Lucknow 10k @ I'm VIP Independent Escorts Gir...Lucknow 💋 High Class Call Girls Lucknow 10k @ I'm VIP Independent Escorts Gir...
Lucknow 💋 High Class Call Girls Lucknow 10k @ I'm VIP Independent Escorts Gir...
 
The Selfspace Journal Preview by Mindbrush
The Selfspace Journal Preview by MindbrushThe Selfspace Journal Preview by Mindbrush
The Selfspace Journal Preview by Mindbrush
 
Call Girls in Kalyan Vihar Delhi 💯 Call Us 🔝8264348440🔝
Call Girls in Kalyan Vihar Delhi 💯 Call Us 🔝8264348440🔝Call Girls in Kalyan Vihar Delhi 💯 Call Us 🔝8264348440🔝
Call Girls in Kalyan Vihar Delhi 💯 Call Us 🔝8264348440🔝
 
Top Rated Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Understanding Relationship Anarchy: A Guide to Liberating Love | CIO Women Ma...
Understanding Relationship Anarchy: A Guide to Liberating Love | CIO Women Ma...Understanding Relationship Anarchy: A Guide to Liberating Love | CIO Women Ma...
Understanding Relationship Anarchy: A Guide to Liberating Love | CIO Women Ma...
 
Lilac Illustrated Social Psychology Presentation.pptx
Lilac Illustrated Social Psychology Presentation.pptxLilac Illustrated Social Psychology Presentation.pptx
Lilac Illustrated Social Psychology Presentation.pptx
 
REFLECTIONS Newsletter Jan-Jul 2024.pdf.pdf
REFLECTIONS Newsletter Jan-Jul 2024.pdf.pdfREFLECTIONS Newsletter Jan-Jul 2024.pdf.pdf
REFLECTIONS Newsletter Jan-Jul 2024.pdf.pdf
 
Call Girls In Andheri East Call US Pooja📞 9892124323 Book Hot And
Call Girls In Andheri East Call US Pooja📞 9892124323 Book Hot AndCall Girls In Andheri East Call US Pooja📞 9892124323 Book Hot And
Call Girls In Andheri East Call US Pooja📞 9892124323 Book Hot And
 
文凭办理《原版美国USU学位证书》犹他州立大学毕业证制作成绩单修改
文凭办理《原版美国USU学位证书》犹他州立大学毕业证制作成绩单修改文凭办理《原版美国USU学位证书》犹他州立大学毕业证制作成绩单修改
文凭办理《原版美国USU学位证书》犹他州立大学毕业证制作成绩单修改
 
Dhule Call Girls #9907093804 Contact Number Escorts Service Dhule
Dhule Call Girls #9907093804 Contact Number Escorts Service DhuleDhule Call Girls #9907093804 Contact Number Escorts Service Dhule
Dhule Call Girls #9907093804 Contact Number Escorts Service Dhule
 
办理西悉尼大学毕业证成绩单、制作假文凭
办理西悉尼大学毕业证成绩单、制作假文凭办理西悉尼大学毕业证成绩单、制作假文凭
办理西悉尼大学毕业证成绩单、制作假文凭
 
《塔夫斯大学毕业证成绩单购买》做Tufts文凭毕业证成绩单/伪造美国假文凭假毕业证书图片Q微信741003700《塔夫斯大学毕业证购买》《Tufts毕业文...
《塔夫斯大学毕业证成绩单购买》做Tufts文凭毕业证成绩单/伪造美国假文凭假毕业证书图片Q微信741003700《塔夫斯大学毕业证购买》《Tufts毕业文...《塔夫斯大学毕业证成绩单购买》做Tufts文凭毕业证成绩单/伪造美国假文凭假毕业证书图片Q微信741003700《塔夫斯大学毕业证购买》《Tufts毕业文...
《塔夫斯大学毕业证成绩单购买》做Tufts文凭毕业证成绩单/伪造美国假文凭假毕业证书图片Q微信741003700《塔夫斯大学毕业证购买》《Tufts毕业文...
 
Breath, Brain & Beyond_A Holistic Approach to Peak Performance.pdf
Breath, Brain & Beyond_A Holistic Approach to Peak Performance.pdfBreath, Brain & Beyond_A Holistic Approach to Peak Performance.pdf
Breath, Brain & Beyond_A Holistic Approach to Peak Performance.pdf
 
Call Girls Anjuna beach Mariott Resort ₰8588052666
Call Girls Anjuna beach Mariott Resort ₰8588052666Call Girls Anjuna beach Mariott Resort ₰8588052666
Call Girls Anjuna beach Mariott Resort ₰8588052666
 
CALL ON ➥8923113531 🔝Call Girls Adil Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Adil Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Adil Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Adil Nagar Lucknow best Female service
 

CSS Extenders

  • 1. Intro to CSS Extenders: SASS LESS Bonus: Compass Framework PyWeb-IL #22 / 27 Dec 2010 http://flic.kr/p/768ooD
  • 2. This frontend dude maintains… a production site with lots of CSS a heavy drinking habit a growing hatred for humanity http://flic.kr/p/5cCATU
  • 3. CSS can be annoying. Here are some workarounds that might make you SMILE
  • 4. CSS ANNOYANCES variables class mixins rule nesting math
  • 6. srsly? at pyweb? (please don’t shoot me)
  • 7. SASS LESS sass-lang.com lesscss.org
  • 8. CleverCSS very similar • not as mature • not actively developed
  • 9.
  • 10. variables variables class mixins class mixins rule nesting rule nesting math math
  • 11. DSL is for losers. CleverCSS SASS LESS DSL CSS Superset
  • 12. Yeah, um, what he said… CleverCSS SASS LESS (.scss) DSL CSS Superset
  • 14. gem install haml gem install less .scss .less DSL: .sass
  • 16. $mycolor: #ddeeff; @mycolor: #ddeeff; $myborder: 3px; @myborder: 3px; #mynav { #mynav { background-color: $mycolor; background-color: @mycolor; color: $mycolor + #111; color: @mycolor + #111; } } .hasborder { .hasborder { border: $myborder solid black; border: @myborder solid black; padding: $myborder * 4; padding: @myborder * 4; } }
  • 17. Basic Color Math Basic Color Math $mycolor + #111 @mycolor + #111 Fancy color functions lighten($mycolor, 20%) Advantage: SASS
  • 19. @mixin sidebar { .sidebar { font-size: 14px; font-size: 14px; background-color: #ddd; background-color: #ddd; width: 100px; width: 100px } } .sidebar_right { .sidebar_right { @include sidebar; .sidebar; float: right; float: right; } } .sidebar_left { .sidebar_left { @include sidebar; .sidebar; float: left; float: left; } }
  • 20. @mixin sidebar($width: 100px) { .sidebar(@width: 100px) { font-size: 14px; font-size: 14px; background-color: #ddd; background-color: #ddd; width: $width; width: @width; } } .sidebar_right { .sidebar_right { @include sidebar; .sidebar; float: right; float: right; } } .sidebar_right_wide { .sidebar_right_wide { @include sidebar(150px); .sidebar(150px); float: right; float: right; } }
  • 22. #header { color: green; } #header a { text-decoration: none; color: red; }
  • 23. #header #header a #header ul #header ul li #header ul li strong #content a #content ul … #FML
  • 24. #header { #header { color: green; color: green; a{ a{ text-decoration: none; text-decoration: none; color: red; color: red; } } a.special { a.special { font-weight: bold; font-weight: bold; color: blue; color: blue; } } } }
  • 25. #header { color: green; border: { width: 1px; color: black; style: solid; } } ?
  • 27. .error { color: red; } .error.severe { @extend .error; font-weight: bold; } ?
  • 29. /* _mysnippet.scss */ /* mysnippet.less */ … … /* style.scss */ /* style.less */ @import “mysnippet” @import “mysnippet”
  • 30. Rope! enough for you to hang yourself with.
  • 32. sass style.scss:style.css lessc style.less sass srcdir/sass:srcdir/css
  • 33. sass style.scss:style.css lessc style.less sass srcdir/sass:srcdir/css sass --watch style.scss:style.css lessc style.less --watch sass --watch srcdir/sass:srcdir/css
  • 34. More functionality Less functionality More documentation Less documentation Took ideas from LESS Took ideas from SASS Core is the same Core is the same
  • 35. More functionality Less functionality More documentation Less documentation Took ideas from LESS Took ideas from SASS Core is the same Core is the same
  • 36. A CSS Authoring Framework based on SASS http://compass-style.org but really, you should see http://beta.compass-style.org
  • 37. Like Django for CSS extensible, best-practice implementations that you don’t need to reinvent
  • 38. Installing gem install compass compass create /path/to/project
  • 39. _BASE.SCSS $brand_color: #acd29f; $base_font_size: 16px; @import “compass/reset”; @import “compass/utilities”; …
  • 40. MYAPP.CSS @import “base”; /* your sassy styles go here. */
  • 41. DEJA VU? {% extends “base.html” %} <!-- your markup goes here. -->
  • 42. END PRESENTATIONAL MARKUP <body id=“blog-detail”> <article class=“wrap”> <header class=“grid-12”>…</header> <div class=“grid-8” id=“content”>…</div> <aside class=“grid-4” id>…</aside> <footer class=“grid-12”>…</footer> </article> </body>
  • 43. END PRESENTATIONAL MARKUP @import “blueprint” @mixin two-column { /* two-col layout on a 12-col grid */ article { @include container; header, footer { @include column(12); } aside { @include column(4); } .content { @include column(8); } } } body#blog-detail, body#blog-list { @include two-column; }
  • 44. END PRESENTATIONAL MARKUP <body id=“blog-detail”> <article class=“wrap”> <header class=“grid-12”>…</header> <div class=“grid-8” id=“content”>…</div> <aside class=“grid-4” id>…</aside> <footer class=“grid-12”>…</footer> </article> </body> <body id=“blog-detail”> <article> <header>…</header> <div id=“content”>…</div> <aside>…</aside> <footer>…</footer> </article> </body>
  • 45. COST: LARGER CSS Generated CSS body#blog-detail article { /* wrap styles copied here */ } body#blog-detail article header, body#blog-detail article footer { /* grid-12 styles copied here */} body #blog-detail article aside { /* grid-4 styles copied here */ }
  • 46. VENDOR PREFIX HELL @import “compass/css3” .alert { background-color: red; @include border-radius(4px) }
  • 47. VENDOR PREFIX HELL .alert { background-color: red; -webkit-border-radius: 4px; -moz-border-radius: 4px; -o-border-radius: 4px; -ms-border-radius: 4px; -khtml-border-radius: 4px; border-radius: 4px; }
  • 48. SAME POWERFUL TECHNIQUES, NEW LOW PRICE cross-browser hacks and fixes shortcuts around verbose CSS pre-baked layout (ex: sticky footer) spriting extensions!
  • 49. DEPLOYMENT I still haven’t completely figured this out. Trigger compilation from Fabric. Bonus: sass --style compressed infile:outfile
  • 50. Power complexity can’t use fancy GUI editors (SASS) toolchain addition Still pretty awesome.
  • 52. Thank you! @idangazit