SlideShare uma empresa Scribd logo
1 de 18
Learn Sass + Compass
Quick
Billy Shih - Code Fellows - May 21, 2013
Demo and notes on
http://github.com/bbshih/sass_presentation
http://github.com/bbshih/sass_presentation
Syntactically Awesome
Stylesheets
1. Indented syntax (.sass)
2. SCSS (.scss)
2. SCSS (.scss)
2. SCSS (.scss)
.sass .scss become .css
Variables
Nesting
Mixins
Selector Inheritence
Selector Inheritence
Selector Inheritence
Selector Inheritence
Compass = CSS SASS
Framework
group :assets do
gem 'sass-rails' # if running rails 3.1 or greater
gem 'compass-rails'
end
In your project directory run:
$ bundle
$ bundle exec compass init
$ bundle exec compass init
$ bundle exec compass init
$ bundle exec compass init
$ bundle exec compass init
$ bundle exec compass init
$ bundle exec compass init
$ bundle exec compass init
$ bundle exec compass init
Rename your application.css to
application.css.scss and add to the file:
@import "compass"
Create new .scss files and @import them
into the application.css.scss
Create new .scss files and @import them
into the application.css.scss
Create new .scss files and @import them
into the application.css.scss
Create new .scss files and @import them
into the application.css.scss
Create new .scss files and @import them
Variables
CSS SCSS
h2 { color: #ff00ee;}th
{ background-color: #ff00ee;}a
{ color: #ff00ee;}
$pink: #ff00ee;$green: #11aa00;$bright: $green;
$link: $pink;h2 { color: $bright;}th
{ background-color: $bright;}a { color: $link;}
Nesting
.main { border: 5px solid green;
font-size:20px;}.main th { color:
red;}th { color: blue;}
.main { border: 5px solid green;
font-size:20px; th { color:
red; }}th { color: blue; }
Mixins
p { background-image:
url("/assets/mindblown.gif"); height:
200px;}h1 { background-image:
url("/assets/mindblown.gif"); height:
200px;}
@mixin mindblown { background-
image: image-url("mindblown.gif");
height: 200px;}p { @include
mindblown;}h1 { @include
mindblown;}
Mixins w/ argument
@mixin mindblown { background-
image: image-url("mindblown.gif");
height: 200px;}p { @include
mindblown;}h1 { @include
mindblown;
height: 400px;}
@mixin mindblown($height)
{ background-image: image-
url("mindblown.gif"); height:
$height;}p { @include
mindblown(200px);}h1 { @include
mindblown(400px);
}
Selector Inheritence
HTML:
<div class=”alert
seriousAlert”></div>
CSS:
.alert { background-color: red; font-
size: 20px; text-align:
center;}.seriousAlert { border: 5px
solid blue;
HTML:
<div class=”seriousAlert”></div>
SCSS:
.alert { background-color: red; font-
size: 20px; text-align:
center;}.seriousAlert { @extend
.alert; border: 5px solid blue;}
Compass
.radius { -webkit-border-radius:
25px; -moz-border-radius: 25px;
-ms-border-radius: 25px; -o-border-
radius: 25px; border-radius:
25px;}table { border: 20px solid
orange;}
.radius { @include border-
radius(25px); }table { border: 20px
solid orange;}
Compass
$base-font-size: 16px;
$base-line-height: 15px;
@include establish-baseline;
Links
• http://sass-lang.com/
• http://compass-style.org/
@tobillys
me@billyshih.com
me@billyshih.com

Mais conteúdo relacionado

Destaque

Alex_Wilman_R_2016
Alex_Wilman_R_2016Alex_Wilman_R_2016
Alex_Wilman_R_2016
Alex Wilman
 
Paul Turner Resume 2015a
Paul Turner Resume 2015aPaul Turner Resume 2015a
Paul Turner Resume 2015a
Paul Turner
 
Jenkins_Joshua Resume 2016
Jenkins_Joshua Resume 2016Jenkins_Joshua Resume 2016
Jenkins_Joshua Resume 2016
Joshua Jenkins
 
Sunny Patel Resume 2016
Sunny Patel Resume 2016Sunny Patel Resume 2016
Sunny Patel Resume 2016
Sunny Patel
 
John Michael Rzepkowski Resume Oct2015
John Michael Rzepkowski Resume Oct2015John Michael Rzepkowski Resume Oct2015
John Michael Rzepkowski Resume Oct2015
John Rzepkowski
 
TadHenryResume2016
TadHenryResume2016TadHenryResume2016
TadHenryResume2016
Tad Henry
 

Destaque (18)

Front End Badassery with Sass
Front End Badassery with SassFront End Badassery with Sass
Front End Badassery with Sass
 
Theming and Sass
Theming and SassTheming and Sass
Theming and Sass
 
Stylesheet Wrangling with SCSS
Stylesheet Wrangling with SCSSStylesheet Wrangling with SCSS
Stylesheet Wrangling with SCSS
 
Preprocessor presentation
Preprocessor presentationPreprocessor presentation
Preprocessor presentation
 
Frontend-Entwicklung mit SASS & Compass
Frontend-Entwicklung mit SASS & CompassFrontend-Entwicklung mit SASS & Compass
Frontend-Entwicklung mit SASS & Compass
 
Performance front end language
Performance front end languagePerformance front end language
Performance front end language
 
Getting Started with Sass & Compass
Getting Started with Sass & CompassGetting Started with Sass & Compass
Getting Started with Sass & Compass
 
老成的Sass&Compass
老成的Sass&Compass老成的Sass&Compass
老成的Sass&Compass
 
Alex_Wilman_R_2016
Alex_Wilman_R_2016Alex_Wilman_R_2016
Alex_Wilman_R_2016
 
Résumé of Raju Vaneshwar Nareshwar
Résumé of Raju Vaneshwar NareshwarRésumé of Raju Vaneshwar Nareshwar
Résumé of Raju Vaneshwar Nareshwar
 
Sass(SCSS)について
Sass(SCSS)についてSass(SCSS)について
Sass(SCSS)について
 
Sass - Getting Started with Sass!
Sass - Getting Started with Sass!Sass - Getting Started with Sass!
Sass - Getting Started with Sass!
 
Paul Turner Resume 2015a
Paul Turner Resume 2015aPaul Turner Resume 2015a
Paul Turner Resume 2015a
 
Save time by using SASS/SCSS
Save time by using SASS/SCSSSave time by using SASS/SCSS
Save time by using SASS/SCSS
 
Jenkins_Joshua Resume 2016
Jenkins_Joshua Resume 2016Jenkins_Joshua Resume 2016
Jenkins_Joshua Resume 2016
 
Sunny Patel Resume 2016
Sunny Patel Resume 2016Sunny Patel Resume 2016
Sunny Patel Resume 2016
 
John Michael Rzepkowski Resume Oct2015
John Michael Rzepkowski Resume Oct2015John Michael Rzepkowski Resume Oct2015
John Michael Rzepkowski Resume Oct2015
 
TadHenryResume2016
TadHenryResume2016TadHenryResume2016
TadHenryResume2016
 

Semelhante a Learn Sass and Compass quick

Sass and Compass - Getting Started
Sass and Compass - Getting StartedSass and Compass - Getting Started
Sass and Compass - Getting Started
edgincvg
 
Simple introduction Sass
Simple introduction SassSimple introduction Sass
Simple introduction Sass
Zeeshan Ahmed
 
Rapid Prototyping
Rapid PrototypingRapid Prototyping
Rapid Prototyping
Even Wu
 
SASS is more than LESS
SASS is more than LESSSASS is more than LESS
SASS is more than LESS
Itai Koren
 
CSSプリプロセッサの取扱説明書
CSSプリプロセッサの取扱説明書CSSプリプロセッサの取扱説明書
CSSプリプロセッサの取扱説明書
拓樹 谷
 

Semelhante a Learn Sass and Compass quick (20)

Sass and Compass - Getting Started
Sass and Compass - Getting StartedSass and Compass - Getting Started
Sass and Compass - Getting Started
 
SASS, Compass, Gulp, Greensock
SASS, Compass, Gulp, GreensockSASS, Compass, Gulp, Greensock
SASS, Compass, Gulp, Greensock
 
Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)
 
Using Sass - Building on CSS
Using Sass - Building on CSSUsing Sass - Building on CSS
Using Sass - Building on CSS
 
CSS Extenders
CSS ExtendersCSS Extenders
CSS Extenders
 
Modularization css with sass
Modularization css with sassModularization css with sass
Modularization css with sass
 
Managing responsive websites with css preprocessors.
Managing responsive websites with css preprocessors. Managing responsive websites with css preprocessors.
Managing responsive websites with css preprocessors.
 
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
 
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
 
Work and play with SASS & Compass
Work and play with SASS & CompassWork and play with SASS & Compass
Work and play with SASS & Compass
 
Simple introduction Sass
Simple introduction SassSimple introduction Sass
Simple introduction Sass
 
The New UI - Staying Strong with Flexbox, SASS, and {{Mustache.js}}
The New UI - Staying Strong with Flexbox, SASS, and {{Mustache.js}}The New UI - Staying Strong with Flexbox, SASS, and {{Mustache.js}}
The New UI - Staying Strong with Flexbox, SASS, and {{Mustache.js}}
 
LESS : The dynamic stylesheet language
LESS : The dynamic stylesheet languageLESS : The dynamic stylesheet language
LESS : The dynamic stylesheet language
 
SASS Preprocessor
SASS PreprocessorSASS Preprocessor
SASS Preprocessor
 
PostCss
PostCssPostCss
PostCss
 
Rapid Prototyping
Rapid PrototypingRapid Prototyping
Rapid Prototyping
 
SASS is more than LESS
SASS is more than LESSSASS is more than LESS
SASS is more than LESS
 
CSS 開發加速指南-Sass & Compass
CSS 開發加速指南-Sass & CompassCSS 開發加速指南-Sass & Compass
CSS 開發加速指南-Sass & Compass
 
CSSプリプロセッサの取扱説明書
CSSプリプロセッサの取扱説明書CSSプリプロセッサの取扱説明書
CSSプリプロセッサの取扱説明書
 
Deep dive into sass
Deep dive into sassDeep dive into sass
Deep dive into sass
 

Último

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Último (20)

Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
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
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
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 - 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 ...
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
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...
 

Learn Sass and Compass quick

Notas do Editor

  1. - Extension of CSS3 that adds features that programming languages have - Make it easier to write and manage CSS - Interpreter translates Sass into CSS
  2. 2 acceptable syntaxes with 2 file types: - Indented syntax(.sass) - Similar to Haml - SCSS Uses CSS semantics, so CSS is valid SCSS (I&apos;ll be using this in the demo)
  3. - Sass interpreter spits out css files from sass files - Automatic with rails and Sass gem - Also has a watcher that can look for updates to sass files and automatically generate .css
  4. - Variables allow you to set a value in one place - Nesting organizes styles and saves you from typing our classes or selectors over and over - Mixins
  5. - Open-source CSS framework - Uses Sass to provide mixins that solve common problems encountered when creating CSS files