SlideShare a Scribd company logo
1 of 24
Download to read offline
What we'll Learn
Learn the SASS Syntax
Utilize Compass for compiling
Take a look at Basic and learn how to put our
knowledge to practice
What is SASS?
Syntactically Awesome Stylesheets.
What is SASS?
Sass makes CSS fun again.
What is SASS?
SCSS (Sassy CSS. Newer syntax)
a superset of CSS3’s syntax
SASS (Older syntax)
uses indentation instead of brackets and semi-colons
What is SASS?
nested rules
variables
mixins
selector inheritance
Installing SASS
need Ruby, Gem, and HAML
OSX: http://hivelogic.com/articles/compiling-
ruby-rubygems-and-rails-on-snow-leopard
Linux: you probably can figure this out....
Windows: good luck...
What is Compass?
Compass is a stylesheet authoring tool that uses the
Sass stylesheet language to make your stylesheets
smaller and your web site easier to maintain.
Installing Compass
gem install compass
What we'll use Compass for...
automajically compile our SASS files
# Require any additional compass plugins here.
project_type = :stand_alone
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "css"
sass_dir = "sass"
images_dir = "images"
javascripts_dir = "js"
output_style = :compact
# To enable relative paths to assets via compass helper functions.
Uncomment:
# relative_assets = true
But...
as of SASS 3...
files prefixed with underscore are ignored.
sass --watch sass:css (sassdir:outputdir)
Examples: Nested Rules
SASSSCSS
table.hl {
margin: 2em 0;
td.ln {
text-align: right;
}
}
li {
font: {
family: serif;
weight: bold;
size: 1.2em;
}
}
table.hl
margin: 2em 0
td.ln
text-align: right
li
font:
family: serif
weight: bold
size: 1.2em
Examples: Nested Rules
table.hl {
margin: 2em 0;
}
table.hl td.ln {
text-align: right;
}
li {
font-family: serif;
font-weight: bold;
font-size: 1.2em;
}
CSS
Examples: Variables
SASSSCSS
$blue: #3bbfce;
$margin: 16px;
.content-navigation {
border-color: $blue;
color:
darken($blue, 9%);
}
.border {
padding: $margin / 2;
margin: $margin / 2;
border-color: $blue;
}
$blue: #3bbfce
$margin: 16px
.content-navigation
border-color: $blue
color: darken($blue, 9%)
.border
padding: $margin / 2
margin: $margin / 2
border-color: $blue
Examples: Variables
.content-navigation {
border-color: #3bbfce;
color: #2b9eab;
}
.border {
padding: 8px;
margin: 8px;
border-color: #3bbfce;
}
CSS
Examples: Mixins
SASSSCSS
@mixin table-base {
th {
text-align: center;
font-weight: bold;
}
td, th {padding: 2px}
}
@mixin left($dist) {
float: left;
margin-left: $dist;
}
#data {
@include left(10px);
@include table-base;
}
@mixin table-base
th
text-align: center
font-weight: bold
td, th
padding: 2px
@mixin left($dist)
float: left
margin-left: $dist
#data
@include left(10px)
@include table-base
Examples: Mixins
#data {
float: left;
margin-left: 10px;
}
#data th {
text-align: center;
font-weight: bold;
}
#data td, #data th {
padding: 2px;
}
CSS
Examples: Selector Inheritance
SASSSCSS
.error {
border: 1px #f00;
background: #fdd;
}
.error.intrusion {
font-size: 1.3em;
font-weight: bold;
}
.badError {
@extend .error;
border-width: 3px;
}
.error
border: 1px #f00
background: #fdd
.error.intrusion
font-size: 1.3em
font-weight: bold
.badError
@extend .error
border-width: 3px
Examples: Selector Inheritance
.error, .badError {
border: 1px #f00;
background: #fdd;
}
.error.intrusion,
.badError.intrusion {
font-size: 1.3em;
font-weight: bold;
}
.badError {
border-width: 3px;
}
CSS
Examples: Conditional Statements
SASS
=views-row($margin: $baseline, $divide: false,
$border_color: #CCC)
+pie-clearfix
@if $divide
border-bottom: 1px solid $border_color
margin-bottom: $margin * 0.5
@else
margin-bottom: $margin * 0.5
p
&:last-of-type
margin-bottom: 0
#main-content .item
+views-row($baseline, true, $brand_blue)
Other Languages
SASS, Less, Turbine, Switch CSS, CSS
Cacheer, CSSPP, ... and more.
http://bit.ly/CSSPreprocessors
Convert!
$ css2sass input output (older syntax)
$ sassconvert [options] input output (newer syntax)$
sass-convert --from less --to scss --recursive .
Convert!
Textmate Bundle
http://github.com/seaofclouds/sass-textmate-bundle
Foldable Blocks in Texmate
http://nimbupani.com/foldable-css-blocks-in-sass-with-textmate.html
Drupal Resources
Compass: http://drupal.org/project/compass
Basic: http://drupal.org/project/basic
Less: http://drupal.org/project/less

More Related Content

What's hot

Drupal & CSS Preprocessors
Drupal & CSS PreprocessorsDrupal & CSS Preprocessors
Drupal & CSS Preprocessors
kdmarks
 
SASS is more than LESS
SASS is more than LESSSASS is more than LESS
SASS is more than LESS
Itai Koren
 
CSS preprocessor: why and how
CSS preprocessor: why and howCSS preprocessor: why and how
CSS preprocessor: why and how
mirahman
 
Visualizing The Code
Visualizing The CodeVisualizing The Code
Visualizing The Code
sdireland
 
Links and Navigation
Links and NavigationLinks and Navigation
Links and Navigation
sdireland
 
Web topic 14 cascading style sheets
Web topic 14  cascading style sheetsWeb topic 14  cascading style sheets
Web topic 14 cascading style sheets
CK Yang
 
Shaping Up With CSS
Shaping Up With CSSShaping Up With CSS
Shaping Up With CSS
sdireland
 

What's hot (19)

Drupal & CSS Preprocessors
Drupal & CSS PreprocessorsDrupal & CSS Preprocessors
Drupal & CSS Preprocessors
 
CSS Introduction
CSS IntroductionCSS Introduction
CSS Introduction
 
The Dark Arts of CSS
The Dark Arts of CSSThe Dark Arts of CSS
The Dark Arts of CSS
 
CSS 開發加速指南-Sass & Compass
CSS 開發加速指南-Sass & CompassCSS 開發加速指南-Sass & Compass
CSS 開發加速指南-Sass & Compass
 
SASS is more than LESS
SASS is more than LESSSASS is more than LESS
SASS is more than LESS
 
Back to the Basics - 2 - HTML & CSS
Back to the Basics - 2 - HTML & CSSBack to the Basics - 2 - HTML & CSS
Back to the Basics - 2 - HTML & CSS
 
CSS preprocessor: why and how
CSS preprocessor: why and howCSS preprocessor: why and how
CSS preprocessor: why and how
 
Preprocessor presentation
Preprocessor presentationPreprocessor presentation
Preprocessor presentation
 
Css Best Practices
Css Best PracticesCss Best Practices
Css Best Practices
 
Static websites assignment 1 - CIT012753
Static websites assignment 1 - CIT012753Static websites assignment 1 - CIT012753
Static websites assignment 1 - CIT012753
 
Visualizing The Code
Visualizing The CodeVisualizing The Code
Visualizing The Code
 
Links and Navigation
Links and NavigationLinks and Navigation
Links and Navigation
 
CSS
CSSCSS
CSS
 
Curso CSS3 com Sass e Compass - Aula 01 - Introducão
Curso CSS3 com Sass e Compass - Aula 01 - IntroducãoCurso CSS3 com Sass e Compass - Aula 01 - Introducão
Curso CSS3 com Sass e Compass - Aula 01 - Introducão
 
Html Css Mistakes
Html Css MistakesHtml Css Mistakes
Html Css Mistakes
 
Web topic 14 cascading style sheets
Web topic 14  cascading style sheetsWeb topic 14  cascading style sheets
Web topic 14 cascading style sheets
 
Less
LessLess
Less
 
Shaping Up With CSS
Shaping Up With CSSShaping Up With CSS
Shaping Up With CSS
 
Css & css3
Css & css3Css & css3
Css & css3
 

Similar to Pacific Northwest Drupal Summit: Basic & SASS

Simple introduction Sass
Simple introduction SassSimple introduction Sass
Simple introduction Sass
Zeeshan Ahmed
 
Elegant CSS Design In Drupal: LESS vs Sass
Elegant CSS Design In Drupal: LESS vs SassElegant CSS Design In Drupal: LESS vs Sass
Elegant CSS Design In Drupal: LESS vs Sass
Mediacurrent
 
Dallas Drupal Days 2012 - Introduction to less sass-compass
Dallas Drupal Days 2012  - Introduction to less sass-compassDallas Drupal Days 2012  - Introduction to less sass-compass
Dallas Drupal Days 2012 - Introduction to less sass-compass
Chris Lee
 

Similar to Pacific Northwest Drupal Summit: Basic & SASS (20)

Intro to SASS CSS
Intro to SASS CSSIntro to SASS CSS
Intro to SASS CSS
 
Simple introduction Sass
Simple introduction SassSimple introduction Sass
Simple introduction Sass
 
CSS Extenders
CSS ExtendersCSS Extenders
CSS Extenders
 
Advanced sass
Advanced sassAdvanced sass
Advanced sass
 
UNIT 3.ppt
UNIT 3.pptUNIT 3.ppt
UNIT 3.ppt
 
Theming and Sass
Theming and SassTheming and Sass
Theming and Sass
 
Deep dive into sass
Deep dive into sassDeep dive into sass
Deep dive into sass
 
Less css
Less cssLess css
Less css
 
SCSS Implementation
SCSS ImplementationSCSS Implementation
SCSS Implementation
 
Elegant CSS Design In Drupal: LESS vs Sass
Elegant CSS Design In Drupal: LESS vs SassElegant CSS Design In Drupal: LESS vs Sass
Elegant CSS Design In Drupal: LESS vs Sass
 
Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)
 
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)
 
Getting Started with Sass & Compass
Getting Started with Sass & CompassGetting Started with Sass & Compass
Getting Started with Sass & Compass
 
SASS Lecture
SASS Lecture SASS Lecture
SASS Lecture
 
Big Frontends Made Simple
Big Frontends Made SimpleBig Frontends Made Simple
Big Frontends Made Simple
 
Finding your way with Sass+Compass
Finding your way with Sass+CompassFinding your way with Sass+Compass
Finding your way with Sass+Compass
 
Css preprocessor-140606115334-phpapp01
Css preprocessor-140606115334-phpapp01Css preprocessor-140606115334-phpapp01
Css preprocessor-140606115334-phpapp01
 
Authoring Stylesheets with Compass & Sass
Authoring Stylesheets with Compass & SassAuthoring Stylesheets with Compass & Sass
Authoring Stylesheets with Compass & Sass
 
Dallas Drupal Days 2012 - Introduction to less sass-compass
Dallas Drupal Days 2012  - Introduction to less sass-compassDallas Drupal Days 2012  - Introduction to less sass-compass
Dallas Drupal Days 2012 - Introduction to less sass-compass
 
Css frameworks
Css frameworksCss frameworks
Css frameworks
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 

Pacific Northwest Drupal Summit: Basic & SASS

  • 1.
  • 2. What we'll Learn Learn the SASS Syntax Utilize Compass for compiling Take a look at Basic and learn how to put our knowledge to practice
  • 3. What is SASS? Syntactically Awesome Stylesheets.
  • 4. What is SASS? Sass makes CSS fun again.
  • 5. What is SASS? SCSS (Sassy CSS. Newer syntax) a superset of CSS3’s syntax SASS (Older syntax) uses indentation instead of brackets and semi-colons
  • 6. What is SASS? nested rules variables mixins selector inheritance
  • 7. Installing SASS need Ruby, Gem, and HAML OSX: http://hivelogic.com/articles/compiling- ruby-rubygems-and-rails-on-snow-leopard Linux: you probably can figure this out.... Windows: good luck...
  • 8. What is Compass? Compass is a stylesheet authoring tool that uses the Sass stylesheet language to make your stylesheets smaller and your web site easier to maintain.
  • 10. What we'll use Compass for... automajically compile our SASS files # Require any additional compass plugins here. project_type = :stand_alone # Set this to the root of your project when deployed: http_path = "/" css_dir = "css" sass_dir = "sass" images_dir = "images" javascripts_dir = "js" output_style = :compact # To enable relative paths to assets via compass helper functions. Uncomment: # relative_assets = true
  • 11. But... as of SASS 3... files prefixed with underscore are ignored. sass --watch sass:css (sassdir:outputdir)
  • 12. Examples: Nested Rules SASSSCSS table.hl { margin: 2em 0; td.ln { text-align: right; } } li { font: { family: serif; weight: bold; size: 1.2em; } } table.hl margin: 2em 0 td.ln text-align: right li font: family: serif weight: bold size: 1.2em
  • 13. Examples: Nested Rules table.hl { margin: 2em 0; } table.hl td.ln { text-align: right; } li { font-family: serif; font-weight: bold; font-size: 1.2em; } CSS
  • 14. Examples: Variables SASSSCSS $blue: #3bbfce; $margin: 16px; .content-navigation { border-color: $blue; color: darken($blue, 9%); } .border { padding: $margin / 2; margin: $margin / 2; border-color: $blue; } $blue: #3bbfce $margin: 16px .content-navigation border-color: $blue color: darken($blue, 9%) .border padding: $margin / 2 margin: $margin / 2 border-color: $blue
  • 15. Examples: Variables .content-navigation { border-color: #3bbfce; color: #2b9eab; } .border { padding: 8px; margin: 8px; border-color: #3bbfce; } CSS
  • 16. Examples: Mixins SASSSCSS @mixin table-base { th { text-align: center; font-weight: bold; } td, th {padding: 2px} } @mixin left($dist) { float: left; margin-left: $dist; } #data { @include left(10px); @include table-base; } @mixin table-base th text-align: center font-weight: bold td, th padding: 2px @mixin left($dist) float: left margin-left: $dist #data @include left(10px) @include table-base
  • 17. Examples: Mixins #data { float: left; margin-left: 10px; } #data th { text-align: center; font-weight: bold; } #data td, #data th { padding: 2px; } CSS
  • 18. Examples: Selector Inheritance SASSSCSS .error { border: 1px #f00; background: #fdd; } .error.intrusion { font-size: 1.3em; font-weight: bold; } .badError { @extend .error; border-width: 3px; } .error border: 1px #f00 background: #fdd .error.intrusion font-size: 1.3em font-weight: bold .badError @extend .error border-width: 3px
  • 19. Examples: Selector Inheritance .error, .badError { border: 1px #f00; background: #fdd; } .error.intrusion, .badError.intrusion { font-size: 1.3em; font-weight: bold; } .badError { border-width: 3px; } CSS
  • 20. Examples: Conditional Statements SASS =views-row($margin: $baseline, $divide: false, $border_color: #CCC) +pie-clearfix @if $divide border-bottom: 1px solid $border_color margin-bottom: $margin * 0.5 @else margin-bottom: $margin * 0.5 p &:last-of-type margin-bottom: 0 #main-content .item +views-row($baseline, true, $brand_blue)
  • 21. Other Languages SASS, Less, Turbine, Switch CSS, CSS Cacheer, CSSPP, ... and more. http://bit.ly/CSSPreprocessors
  • 22. Convert! $ css2sass input output (older syntax) $ sassconvert [options] input output (newer syntax)$ sass-convert --from less --to scss --recursive .
  • 23. Convert! Textmate Bundle http://github.com/seaofclouds/sass-textmate-bundle Foldable Blocks in Texmate http://nimbupani.com/foldable-css-blocks-in-sass-with-textmate.html
  • 24. Drupal Resources Compass: http://drupal.org/project/compass Basic: http://drupal.org/project/basic Less: http://drupal.org/project/less