SlideShare ist ein Scribd-Unternehmen logo
1 von 64
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Was ist angesagt?

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

Was ist angesagt? (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
 

Ähnlich wie 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
 

Ähnlich wie 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
 

Mehr von 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
 

Kürzlich hochgeladen

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
 

Kürzlich hochgeladen (20)

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
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
 
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 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...
 
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
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
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
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
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
 
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...
 
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...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
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?
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
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
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 

Compass