SlideShare a Scribd company logo
Introduction to
Less / Sass / Compass

Presented by
Chris Lee
@levelten_chris
Prerequisites

                ● Strong understanding of
                  CSS
                ● Familiarity with control
                  structures, functions,
                  variables
                ● Lazy Desire to
                  be more Efficient
                ● Familiarity CSS3
                ● Interest in Theming
What's in it for me?
... Goals
● Understanding of High Level Purpose of
  Preprocessing languages

● Learn how to get started

● How this works with Drupal...

  Yes, there's a module for that!
CSS




Less / Sass /
Compass
Why should i use less/sass?
● Web is complex.
  No longer simple.

● Front End Performance

● DRY principle

● Frameworks / OOCSS

● Cross-Browser
  Compatibility

● It's easy!
Gaining Front End Performance
● Reduce HTTP Number of Requests

● Reduce, reuse, and recycle css

● Compress assets
Demonstration: Variables
Create a variable file using sass

open "demo1"
Getting started Less / Sass

1. There's a module for it.

2. CLI: node.js / ruby gems

3. Client Side GUI's

Any other methods? Let us all know!
Method 1: Drupal Modules
● Less http://drupal.org/project/less
● Prepro http://drupal.org/project/prepro
● Sassy http://drupal.org/project/sassy


Others
● Live CSS http://drupal.org/project/live_css
● Sass http://drupal.org/project/sass
Method 2: Command Line
Processors

● Node js
  $ npm install less
  $ sudo apt-get install node-less

● ruby gem

  $ gem install sass
  $ gem install compass
Method 3: Client Side GUIs
SimpLess
Mac / Win
http:
//wearekiss.
com/simpless
Method 3: Client Side GUIs
Scout (mac)
http://mhs.
github.
com/scout-app/
Method 3: Client Side GUIs
Compass.app
Mac / win /
linux
http://compass.
handlino.com/
How does one pick a preprocessor?
● Get Excited! Dive in.

● Figure out workflow
Syntax
Differences between Less / Sass?
● Very little differences

● Small syntax issues

● Workflow

● Frameworks / Library advantages
Introductory
Preprocessor Concepts
●   Nested
●   Mixins
●   Control Structures
●   Importing
Same Syntax: Less / Sass / Compass
● Nested Structures

// less                   // sass / scss
// @file style.less.css   // @file style.scss
body {                    body {
  .header {                 .header {
     background: #fc0;         background: #fc0;
   }                         }
}                         }
Same Syntax: Less / Sass / Compass
● Importing files


// less                   // sass or scss
// @file style.less.css   // @file style.scss

@import "file";           @import "foo";
@import 'file.less';      @import "foo.scss";
@import http://foo.       @import "http://foo.com/foo;
com/foo;                  @import url(foo);
@import url(file);
Mixin
"Mixins allow you to define styles that can be
re-used throughout the stylesheet without
needing to resort to non-semantic classes like .
float-left. Mixins can also contain full CSS rules,
and anything else allowed elsewhere in a Sass
document. They can even take arguments
which allows you to produce a wide variety of
styles with very few mixins."

- Sass-Lang.com
Mixin




        TLDR;
Mixin
// Less                         // Sass
.border-radius(@r:0px) {        @mixin border-radius($r:0px) {
   -moz-border-radius: @r;        -moz-border-radius: $r;
   -o-border-radius: @r;          -o-border-radius: $r;
   -khtml-border-radius:@r;       -khtml-border-radius:$r;
    -webkit-border-radius:@r;     -webkit-border-radius:$r;
    border-radius: @r;            border-radius: $r;
}                               }
Mixin
// Less                          // Sass
.border-radius(@r:0px) {         @mixin border-radius($r:0px) {
   -moz-border-radius: @r;         -moz-border-radius: $r;
   -o-border-radius: @r;           -o-border-radius: $r;
   -khtml-border-radius:@r;        -khtml-border-radius:$r;
    -webkit-border-radius:@r;      -webkit-border-radius:$r;
    border-radius: @r;             border-radius: $r;
}                                }

// "Invoke" the mixin            // Invoke the mixin
.myDiv {                         .myDiv {
      .border-radius(2px+2px);      @include border-radius
}                                (2px+2px);
                                 }
Mixin: CSS Output
.myDiv {
  -moz-border-radius: 4px;
  -o-border-radius: 4px;
  -khtml-border-radius: 4px;
   -webkit-border-radius:4px;
   border-radius: 4px;
}
WHAT IT ADDS?!@!
2px + 2px = 4px
Lighten / Darkens
// less
lightness (@color, 10%);
darkness (@color, 10%);

// scss
@include lighten($color, 10%);
@include darken($color, 10%);
Sass project files



Random Live Demonstration Time...

- Demo2 - What is a project file
- Demo3 - Creating a project with compass
Frameworks
Less Frameworks
● Bootstrap
  http://twitter.github.com/bootstrap/
● Centage
  http://centage.peruste.net/
Sass Frameworks
● Compass - http://compass-style.org/
● Bourbon - http://thoughtbot.com/bourbon/
● Foundation - https://github.
  com/zurb/foundation
What is compass?
● sass mixin library
● sass meta framework
● reduce low level tasks

How do i install this?

● Install with a rubygem
  $ gem install compass
Compass Example: Opacity

 @import "compass/css3/opacity"

 div.box {
   $opacity: .9;
   opacity($opacity);
 }
Compass Example: Opacity
div.box {
  filter: progid:DXImageTransform.Microsoft.
Alpha(Opacity=90);
  opacity: 0.9;
}
Compass Example: url helpers
div.box {
  background: image-url('lolcat-bg.jpg');
}
Compass Example: url helpers
div.box {
   background: 'sites/all/themes/foo/images
   /lolcat-bg.jpg?4324343';
}
Learn more
Less
● http://lesscss.org/
● http://leafo.net/lessphp/docs/
Sass
● http://sass-lang.com/
● http://sass-lang.com/docs/yardoc/file.
  SASS_REFERENCE.html
Compass
● http://compass-style.org/
Questions?
Questions?

Arial 48pt. Google
   Powerpoint
Questions?
Thanks!

       Slides:
http://goo.gl/71wK5

More Related Content

PDF
Css to-scss
PPTX
PPTX
Syntactically awesome stylesheets (Sass)
PPTX
PPTX
SASS - CSS with Superpower
PPTX
Introduction to sass
PPTX
Less presentation
PPTX
Sass_Cubet seminar
Css to-scss
Syntactically awesome stylesheets (Sass)
SASS - CSS with Superpower
Introduction to sass
Less presentation
Sass_Cubet seminar

What's hot (20)

PDF
LESS CSS
PPT
PPTX
Sass installation
PPTX
Make your CSS beautiful again
PPTX
Sass - basic to advance
PDF
Compass n Sass
PDF
SASS Preprocessor
ODP
Sass presentation
PPTX
Beautifying senc
KEY
Efficient theming in Drupal
PDF
Sass in 5
PDF
The way to be a developer "What I Need"
PPTX
Twitter Bootstrap Presentation
PDF
Dangerous CSS
PDF
LESS is More
PDF
remodel your persistence layer
PDF
Webpack: What it is, What it does, Whether you need it
PPT
Ruby On Rails
PPT
Rubyonrails 090715105949-phpapp01
KEY
CSS3 for web designer - How to design a visually appealing website
LESS CSS
Sass installation
Make your CSS beautiful again
Sass - basic to advance
Compass n Sass
SASS Preprocessor
Sass presentation
Beautifying senc
Efficient theming in Drupal
Sass in 5
The way to be a developer "What I Need"
Twitter Bootstrap Presentation
Dangerous CSS
LESS is More
remodel your persistence layer
Webpack: What it is, What it does, Whether you need it
Ruby On Rails
Rubyonrails 090715105949-phpapp01
CSS3 for web designer - How to design a visually appealing website
Ad

Viewers also liked (9)

PPTX
支付宝WAP站点收银台适配ios &android
PPTX
用户体验组设计流程
PPTX
SASS 让你更爽的 编写CSS
PPTX
Web app share
PPTX
Understand prototype
PDF
More with LeSS - An Introduction to Large Scale Scrum by Tim Abbott
PPTX
Introduction to LESS
PDF
Why Large Scale Scrum (LeSS)?
PDF
Thiga - Notre retour d'expérience sur le Design sprint
支付宝WAP站点收银台适配ios &android
用户体验组设计流程
SASS 让你更爽的 编写CSS
Web app share
Understand prototype
More with LeSS - An Introduction to Large Scale Scrum by Tim Abbott
Introduction to LESS
Why Large Scale Scrum (LeSS)?
Thiga - Notre retour d'expérience sur le Design sprint
Ad

Similar to Dallas Drupal Days 2012 - Introduction to less sass-compass (20)

PPTX
Elegant CSS Design In Drupal: LESS vs Sass
KEY
Bringing sexy back to CSS: SASS/SCSS, LESS and Compass
PDF
SASS, Compass, Gulp, Greensock
PPT
UNIT 3.ppt
PDF
Preprocessor presentation
PDF
LESS : The dynamic stylesheet language
PPTX
SASS is more than LESS
PPT
CSS előfeldolgozók
PPT
CSS Preprocessors: LESS is more or look SASS-y trying
PPTX
Simple introduction Sass
PDF
Big Frontends Made Simple
PPTX
SASS for WordPress Workshop
PPT
Why less?
PPTX
Introducing grunt, npm and sass
ODP
Deep dive into sass
KEY
Advanced Technology for Web Application Design
PDF
Doing more with LESS
PDF
Fasten RWD Development with Sass
PDF
Do more with {less}
Elegant CSS Design In Drupal: LESS vs Sass
Bringing sexy back to CSS: SASS/SCSS, LESS and Compass
SASS, Compass, Gulp, Greensock
UNIT 3.ppt
Preprocessor presentation
LESS : The dynamic stylesheet language
SASS is more than LESS
CSS előfeldolgozók
CSS Preprocessors: LESS is more or look SASS-y trying
Simple introduction Sass
Big Frontends Made Simple
SASS for WordPress Workshop
Why less?
Introducing grunt, npm and sass
Deep dive into sass
Advanced Technology for Web Application Design
Doing more with LESS
Fasten RWD Development with Sass
Do more with {less}

Recently uploaded (20)

PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
Big Data Technologies - Introduction.pptx
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Machine learning based COVID-19 study performance prediction
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
MYSQL Presentation for SQL database connectivity
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPT
Teaching material agriculture food technology
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
Understanding_Digital_Forensics_Presentation.pptx
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Big Data Technologies - Introduction.pptx
The AUB Centre for AI in Media Proposal.docx
Network Security Unit 5.pdf for BCA BBA.
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Machine learning based COVID-19 study performance prediction
Per capita expenditure prediction using model stacking based on satellite ima...
MYSQL Presentation for SQL database connectivity
MIND Revenue Release Quarter 2 2025 Press Release
Teaching material agriculture food technology
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Encapsulation_ Review paper, used for researhc scholars
Building Integrated photovoltaic BIPV_UPV.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Advanced methodologies resolving dimensionality complications for autism neur...
Understanding_Digital_Forensics_Presentation.pptx

Dallas Drupal Days 2012 - Introduction to less sass-compass

  • 1. Introduction to Less / Sass / Compass Presented by Chris Lee @levelten_chris
  • 2. Prerequisites ● Strong understanding of CSS ● Familiarity with control structures, functions, variables ● Lazy Desire to be more Efficient ● Familiarity CSS3 ● Interest in Theming
  • 3. What's in it for me? ... Goals ● Understanding of High Level Purpose of Preprocessing languages ● Learn how to get started ● How this works with Drupal... Yes, there's a module for that!
  • 4. CSS Less / Sass / Compass
  • 5. Why should i use less/sass? ● Web is complex. No longer simple. ● Front End Performance ● DRY principle ● Frameworks / OOCSS ● Cross-Browser Compatibility ● It's easy!
  • 6. Gaining Front End Performance ● Reduce HTTP Number of Requests ● Reduce, reuse, and recycle css ● Compress assets
  • 7. Demonstration: Variables Create a variable file using sass open "demo1"
  • 8. Getting started Less / Sass 1. There's a module for it. 2. CLI: node.js / ruby gems 3. Client Side GUI's Any other methods? Let us all know!
  • 9. Method 1: Drupal Modules ● Less http://drupal.org/project/less ● Prepro http://drupal.org/project/prepro ● Sassy http://drupal.org/project/sassy Others ● Live CSS http://drupal.org/project/live_css ● Sass http://drupal.org/project/sass
  • 10. Method 2: Command Line Processors ● Node js $ npm install less $ sudo apt-get install node-less ● ruby gem $ gem install sass $ gem install compass
  • 11. Method 3: Client Side GUIs SimpLess Mac / Win http: //wearekiss. com/simpless
  • 12. Method 3: Client Side GUIs Scout (mac) http://mhs. github. com/scout-app/
  • 13. Method 3: Client Side GUIs Compass.app Mac / win / linux http://compass. handlino.com/
  • 14. How does one pick a preprocessor? ● Get Excited! Dive in. ● Figure out workflow
  • 16. Differences between Less / Sass? ● Very little differences ● Small syntax issues ● Workflow ● Frameworks / Library advantages
  • 17. Introductory Preprocessor Concepts ● Nested ● Mixins ● Control Structures ● Importing
  • 18. Same Syntax: Less / Sass / Compass ● Nested Structures // less // sass / scss // @file style.less.css // @file style.scss body { body { .header { .header { background: #fc0; background: #fc0; } } } }
  • 19. Same Syntax: Less / Sass / Compass ● Importing files // less // sass or scss // @file style.less.css // @file style.scss @import "file"; @import "foo"; @import 'file.less'; @import "foo.scss"; @import http://foo. @import "http://foo.com/foo; com/foo; @import url(foo); @import url(file);
  • 20. Mixin "Mixins allow you to define styles that can be re-used throughout the stylesheet without needing to resort to non-semantic classes like . float-left. Mixins can also contain full CSS rules, and anything else allowed elsewhere in a Sass document. They can even take arguments which allows you to produce a wide variety of styles with very few mixins." - Sass-Lang.com
  • 21. Mixin TLDR;
  • 22. Mixin // Less // Sass .border-radius(@r:0px) { @mixin border-radius($r:0px) { -moz-border-radius: @r; -moz-border-radius: $r; -o-border-radius: @r; -o-border-radius: $r; -khtml-border-radius:@r; -khtml-border-radius:$r; -webkit-border-radius:@r; -webkit-border-radius:$r; border-radius: @r; border-radius: $r; } }
  • 23. Mixin // Less // Sass .border-radius(@r:0px) { @mixin border-radius($r:0px) { -moz-border-radius: @r; -moz-border-radius: $r; -o-border-radius: @r; -o-border-radius: $r; -khtml-border-radius:@r; -khtml-border-radius:$r; -webkit-border-radius:@r; -webkit-border-radius:$r; border-radius: @r; border-radius: $r; } } // "Invoke" the mixin // Invoke the mixin .myDiv { .myDiv { .border-radius(2px+2px); @include border-radius } (2px+2px); }
  • 24. Mixin: CSS Output .myDiv { -moz-border-radius: 4px; -o-border-radius: 4px; -khtml-border-radius: 4px; -webkit-border-radius:4px; border-radius: 4px; }
  • 26. 2px + 2px = 4px
  • 27. Lighten / Darkens // less lightness (@color, 10%); darkness (@color, 10%); // scss @include lighten($color, 10%); @include darken($color, 10%);
  • 28. Sass project files Random Live Demonstration Time... - Demo2 - What is a project file - Demo3 - Creating a project with compass
  • 30. Less Frameworks ● Bootstrap http://twitter.github.com/bootstrap/ ● Centage http://centage.peruste.net/
  • 31. Sass Frameworks ● Compass - http://compass-style.org/ ● Bourbon - http://thoughtbot.com/bourbon/ ● Foundation - https://github. com/zurb/foundation
  • 32. What is compass? ● sass mixin library ● sass meta framework ● reduce low level tasks How do i install this? ● Install with a rubygem $ gem install compass
  • 33. Compass Example: Opacity @import "compass/css3/opacity" div.box { $opacity: .9; opacity($opacity); }
  • 34. Compass Example: Opacity div.box { filter: progid:DXImageTransform.Microsoft. Alpha(Opacity=90); opacity: 0.9; }
  • 35. Compass Example: url helpers div.box { background: image-url('lolcat-bg.jpg'); }
  • 36. Compass Example: url helpers div.box { background: 'sites/all/themes/foo/images /lolcat-bg.jpg?4324343'; }
  • 37. Learn more Less ● http://lesscss.org/ ● http://leafo.net/lessphp/docs/ Sass ● http://sass-lang.com/ ● http://sass-lang.com/docs/yardoc/file. SASS_REFERENCE.html Compass ● http://compass-style.org/
  • 41. Thanks! Slides: http://goo.gl/71wK5