SlideShare uma empresa Scribd logo
1 de 64
Baixar para ler offline
Patrick Crowley
http://github.com/mokolabs
Getting oriented
 with Compass
What is Compass?
• Framework for stylesheets
• Framework for stylesheets
• Uses Haml & Sass
• Framework for stylesheets
• Uses Haml & Sass
• Well, really just Sass
• Framework for stylesheets
• Uses Haml & Sass
• Well, really just Sass
• Lightweight
Why do we need
to use Compass?
• Stylesheets are too long
• Stylesheets are too long
• Stylesheets are too complex
• Stylesheets are too long
• Stylesheets are too complex
• Stylesheets are a fucking mess!
• Stylesheets are too long
• Stylesheets are too complex
• Stylesheets are a fucking mess!
• Yeah, I’m talking to you.
But what if...
• I wanna use ERB
• I wanna use ERB
• I think Sass has a weird syntax
• I wanna use ERB
• I think Sass has a weird syntax
• My styles are hand-crafted
• I wanna use ERB
• I think Sass has a weird syntax
• My styles are hand-crafted
• I don’t have many styles yet
How do I get started?
• gem ‘compass’
• gem ‘compass’
• bundle install compass
• gem ‘compass’
• bundle install compass
• compass version
• gem ‘compass’
• bundle install compass
• compass version
• compass init rails /path/to/app
• gem ‘compass’
• bundle install compass
• compass version
• compass init rails /path/to/app
• tweak config/compass.rb
• gem ‘compass’
• bundle install compass
• compass version
• compass init rails /path/to/app
• tweak config/compass.rb
• add app/stylesheets
What are the basics?
.SCSS files
SCSS = Sassy CSS
.scss   .css
app/stylesheets/app.scss
body {
  font-family: Helvetica, Arial, sans-serif;
}

h1 {
  font-size: 28px;
  a {
     text-decoration: none;
  }
}

a {
  color: #FF1E00;
  &:hover {
    color: #336699;
  }
}
public/stylesheets/app.css
body {
  font-family: Helvetica, Arial, sans-serif;
}

h1 {
  font-size: 28px;
}

h1 a {
  text-decoration: none;
}

a {
  color: #FF1E00;
}

a:hover {
  color: #336699;
}
Variables
$blue: #3bbfce;
$margin: 16px;

.content-navigation {
  border-color: $blue;
  color: darken($blue, 9%);
}

.border {
  padding: $margin / 2;
  margin: $margin / 2;
  border-color: $blue;
}
.content-navigation {
  border-color: #3bbfce;
  color: #2b9eab;
}

.border {
  padding: 8px;
  margin: 8px;
  border-color: #3bbfce;
}
Partials
app/stylesheets/app.scss
body {
  font-family: Helvetica, Arial, sans-serif;
}

@import "core/type";
app/stylesheets/core/type.scss
h1, h2, h3, h4, h5 {
  color: #444;
  margin: 12px 0;
}

h1 {
  font-size: 28px;
  margin: 24px 0;
}

h2 {
  clear: left;
  font-size: 24px;
  margin: 18px 0;
}
public/stylesheets/app.css
body {
  font-family: Helvetica, Arial, sans-serif;
}

h1, h2, h3, h4, h5 {
  color: #444;
  margin: 12px 0;
}

h1 {
  font-size: 28px;
  margin: 24px 0;
}

h2 {
  clear: left;
  font-size: 24px;
  margin: 18px 0;
}
Mixins
@mixin large-text {
  font: {
    family: Arial;
    size: 20px;
    weight: bold;
  }
  color: #ff0000;
}
.page-title {
  @include large-text;
  padding: 4px;
  margin-top: 10px;
}
.page-title {
  font-family: Arial;
  font-size: 20px;
  font-weight: bold;
  color: #ff0000;
  padding: 4px;
  margin-top: 10px;
}
Compass =
Mixins on Charlie Sheen
WINNING!
• New CSS 3 hotness
• New CSS 3 hotness
• Blueprint
• New CSS 3 hotness
• Blueprint
• Yahoo UI layouts
• New CSS 3 hotness
• Blueprint
• Yahoo UI layouts
• Grid systems
• New CSS 3 hotness
• Blueprint
• Yahoo UI layouts
• Grid systems
• Fancy buttons
input[type=text],
input[type=password],
textarea {
  @include border-radius(6px);
  border: 1px solid #ccc;
  color: #333;
  font-size: 16px;
  padding: 3px;
  outline: none;
}
How do I organize
 my stylesheets?
app/stylesheets/app.scss
// Compass
@import "compass/reset";
@import "compass/utilities";
@import "compass/css3";

// Libraries
@import "lib/jquery-ui";

// Core
@import   "core/mixin";
@import   "core/colors";
@import   "core/tag";
@import   "core/layout";
@import   "core/message";
@import   "core/form";
@import   "core/widget";

// Features
@import "features/product";
@import "features/user";
Resources
• http://compass-style.org
• http://compass-style.org
• http://compass-style.org
 /docs/reference/compass/
• http://compass-style.org
• http://compass-style.org
 /docs/reference/compass/

• http://github.com
 /chriseppstein/compass
The End

Mais conteúdo relacionado

Mais procurados

01 Introduction To CSS
01 Introduction To CSS01 Introduction To CSS
01 Introduction To CSS
crgwbr
 

Mais procurados (20)

Cascading style sheet part 2
Cascading style sheet   part 2Cascading style sheet   part 2
Cascading style sheet part 2
 
Sass and compass workshop
Sass and compass workshopSass and compass workshop
Sass and compass workshop
 
Doing More With Less
Doing More With LessDoing More With Less
Doing More With Less
 
10 Commandments for efficient CSS architecture [CSSConf.Asia '14]
10 Commandments for efficient CSS architecture [CSSConf.Asia '14]10 Commandments for efficient CSS architecture [CSSConf.Asia '14]
10 Commandments for efficient CSS architecture [CSSConf.Asia '14]
 
SASS - CSS with Superpower
SASS - CSS with SuperpowerSASS - CSS with Superpower
SASS - CSS with Superpower
 
Turbo theming: Introduction to Sass & Compass
Turbo theming: Introduction to Sass & CompassTurbo theming: Introduction to Sass & Compass
Turbo theming: Introduction to Sass & Compass
 
01 Introduction To CSS
01 Introduction To CSS01 Introduction To CSS
01 Introduction To CSS
 
Mastering zen
Mastering zenMastering zen
Mastering zen
 
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
 
ECS19 - Chris Kent - List Formatting in Office 365 and SharePoint 2019
ECS19 - Chris Kent - List Formatting in Office 365 and SharePoint 2019ECS19 - Chris Kent - List Formatting in Office 365 and SharePoint 2019
ECS19 - Chris Kent - List Formatting in Office 365 and SharePoint 2019
 
Css to-scss
Css to-scssCss to-scss
Css to-scss
 
Syntactically awesome stylesheets (Sass)
Syntactically awesome stylesheets (Sass)Syntactically awesome stylesheets (Sass)
Syntactically awesome stylesheets (Sass)
 
Less vs sass
Less vs sassLess vs sass
Less vs sass
 
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
 
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)
 
Agile CSS development with Compass and Sass
Agile CSS development with Compass and SassAgile CSS development with Compass and Sass
Agile CSS development with Compass and Sass
 
Intro to SASS CSS
Intro to SASS CSSIntro to SASS CSS
Intro to SASS CSS
 
CSS and Layout
CSS and LayoutCSS and Layout
CSS and Layout
 

Semelhante a Compass

CSS preprocessor: why and how
CSS preprocessor: why and howCSS preprocessor: why and how
CSS preprocessor: why and how
mirahman
 
Rapid Prototyping
Rapid PrototypingRapid Prototyping
Rapid Prototyping
Even Wu
 
Sass: The Future of Stylesheets
Sass: The Future of StylesheetsSass: The Future of Stylesheets
Sass: The Future of Stylesheets
chriseppstein
 
The Coding Designer's Survival Kit - Capital Camp
The Coding Designer's Survival Kit - Capital CampThe Coding Designer's Survival Kit - Capital Camp
The Coding Designer's Survival Kit - Capital Camp
canarymason
 
Twitter Bootstrap Presentation
Twitter Bootstrap PresentationTwitter Bootstrap Presentation
Twitter Bootstrap Presentation
Duy Do Phan
 
How do speed up web pages? CSS & HTML Tricks
How do speed up web pages? CSS & HTML TricksHow do speed up web pages? CSS & HTML Tricks
How do speed up web pages? CSS & HTML Tricks
Compare Infobase Limited
 

Semelhante a Compass (20)

DrupalCamp Chattanooga - September 2014 - Sass 101
DrupalCamp Chattanooga - September 2014 - Sass 101DrupalCamp Chattanooga - September 2014 - Sass 101
DrupalCamp Chattanooga - September 2014 - Sass 101
 
Sass compass
Sass compassSass compass
Sass compass
 
BILL Hour: Try something new! (like Sass or Compass)
BILL Hour: Try something new! (like Sass or Compass)BILL Hour: Try something new! (like Sass or Compass)
BILL Hour: Try something new! (like Sass or Compass)
 
Css preprocessor-140606115334-phpapp01
Css preprocessor-140606115334-phpapp01Css preprocessor-140606115334-phpapp01
Css preprocessor-140606115334-phpapp01
 
CSS preprocessor: why and how
CSS preprocessor: why and howCSS preprocessor: why and how
CSS preprocessor: why and how
 
CSS
CSSCSS
CSS
 
Rapid Prototyping
Rapid PrototypingRapid Prototyping
Rapid Prototyping
 
CSS 開發加速指南-Sass & Compass
CSS 開發加速指南-Sass & CompassCSS 開發加速指南-Sass & Compass
CSS 開發加速指南-Sass & Compass
 
Getting Started with Sass & Compass
Getting Started with Sass & CompassGetting Started with Sass & Compass
Getting Started with Sass & Compass
 
Oooh shiny
Oooh shinyOooh shiny
Oooh shiny
 
Typography For The Web
Typography For The WebTypography For The Web
Typography For The Web
 
Sass: The Future of Stylesheets
Sass: The Future of StylesheetsSass: The Future of Stylesheets
Sass: The Future of Stylesheets
 
SASS Lecture
SASS Lecture SASS Lecture
SASS Lecture
 
The Coding Designer's Survival Kit - Capital Camp
The Coding Designer's Survival Kit - Capital CampThe Coding Designer's Survival Kit - Capital Camp
The Coding Designer's Survival Kit - Capital Camp
 
Twitter Bootstrap Presentation
Twitter Bootstrap PresentationTwitter Bootstrap Presentation
Twitter Bootstrap Presentation
 
CSS3
CSS3CSS3
CSS3
 
Omeka css
Omeka cssOmeka css
Omeka css
 
Managing responsive websites with css preprocessors.
Managing responsive websites with css preprocessors. Managing responsive websites with css preprocessors.
Managing responsive websites with css preprocessors.
 
Beautifying senc
Beautifying sencBeautifying senc
Beautifying senc
 
How do speed up web pages? CSS & HTML Tricks
How do speed up web pages? CSS & HTML TricksHow do speed up web pages? CSS & HTML Tricks
How do speed up web pages? CSS & HTML Tricks
 

Mais de Patrick Crowley (9)

Mobile web apps
Mobile web appsMobile web apps
Mobile web apps
 
Trucker
TruckerTrucker
Trucker
 
Migrating Legacy Data (Ruby Midwest)
Migrating Legacy Data (Ruby Midwest)Migrating Legacy Data (Ruby Midwest)
Migrating Legacy Data (Ruby Midwest)
 
Migrating Legacy Data
Migrating Legacy DataMigrating Legacy Data
Migrating Legacy Data
 
Paperclip
PaperclipPaperclip
Paperclip
 
CSS for iPhones
CSS for iPhonesCSS for iPhones
CSS for iPhones
 
Rails For Legacy Apps
Rails For Legacy AppsRails For Legacy Apps
Rails For Legacy Apps
 
Headliner
HeadlinerHeadliner
Headliner
 
Styler
StylerStyler
Styler
 

Último

Último (20)

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
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, ...
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
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
 
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
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
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
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 

Compass