SlideShare ist ein Scribd-Unternehmen logo
1 von 23
Downloaden Sie, um offline zu lesen
@mlteal | #WCPhilly | June 2015
Getting Started with SASS
or: All the things I wished for with CSS
@mlteal | #WCPhilly | June 2015
Maura Teal
Web Developer at FanSided
@mlteal | mlteal.com
@mlteal | #WCPhilly | June 2015
What is it?
Syntactically Awesome StyleSheets
A CSS pre-processor that allows us to use logic similar to
real programming languages.
@mlteal | #WCPhilly | June 2015
What do you get?
More organization, sanity because variables,
mixins, and functions.
TL;DR: Build and adjust stylesheets efficiently.
@mlteal | #WCPhilly | June 2015
How Does it Work?
Watch your code while you
work locally and continually
compile into the CSS file
you’ll use in your project.
@mlteal | #WCPhilly | June 2015
Getting Started
1. Install Ruby
2. Install Sass Gem
3. Watch those files:
Alternatively, download a GUI
that takes care of things:
Codekit ($)
Koala (free)
Scout (free)
From the Command Line:
cd path/to/my/sass/folder
sass --watch input.scss:output.css
Ctrl+C to stop watching
@mlteal | #WCPhilly | June 2015
Just want to try it out?
Codepen: http://codepen.io/
Sassmeister: http://sassmeister.com/
@mlteal | #WCPhilly | June 2015
Features
• Nesting
• Variables
• Mixins
• Functions
• Minification
• Libraries
To name a few…
@mlteal | #WCPhilly | June 2015
Nesting
Xzibit knows you like selectors
@mlteal | #WCPhilly | June 2015
Nesting
SASS
.parent {

blockquote, p {

font-family: Times;

}

a {

color: teal;

}

span {

background: yellow;

}

}
CSS
.parent blockquote, 

.parent p {

font-family: Times;

}

.parent a {

color: teal;

}

.parent span {

background: yellow;

}
@mlteal | #WCPhilly | June 2015
Nesting
a {

color: teal;

&.special {

color: gold;

}

&:hover, 

&:active {

font-style: italic;

}

}
a {

color: teal;

}

a.special {

color: gold;

}

a:hover, 

a:active {

font-style: italic;

}
@mlteal | #WCPhilly | June 2015
Variables
$variable-name : /* variable properties here */;
Think colors (hex values or rgba), fonts, sizes,
or even previously defined vars:
$fuchsia : #f0f;
$border-style : 1px solid $fuchsia;
$heading-size : 30px;
$subheading-size : $heading-size / 2;
@mlteal | #WCPhilly | June 2015
Variables
1. Define your color
palette just this one time


$white : #FFFFFF;

$teal : #27ba9a;

$french-blue : #3196da;

$purple : #9a58b5;

$light-grey : #7e8c8d;
2. Abstract it in case all
headings change from
$purple to $teal someday
$heading : $purple;

$sub-heading : $white;

$body-text : $light-grey;

$link : $french-blue;

$accent : $teal;
@mlteal | #WCPhilly | June 2015
Mixins
add candy to your code
@mlteal | #WCPhilly | June 2015
Mixins
Create reusable chunks of CSS
@mixin border-radius($radius) {
-moz-border-radius: $radius;
-webkit-border-radius: $radius;
border-radius: $radius;
}
.container {
@include border-radius(18px);
} .footer {
@include border-radius(6px);
}
.container {
-moz-border-radius: 18px;
-webkit-border-radius: 18px;
border-radius: 18px;
}
.footer {
-moz-border-radius: 6px;
-webkit-border-radius: 6px;
border-radius: 6px;
}
@mlteal | #WCPhilly | June 2015
Functions
Create reusable logic
@function remy($pxsize) {
@return: ($pxsize / 16 )+rem;
}
.container {
font-size: remy(32);
}
.container {
font-size: 2rem;
}
Ref: http://sass-lang.com/documentation/Sass/Script/Functions.html
@mlteal | #WCPhilly | June 2015
Putting it all together
Combining map-get() function with array maps
$iconfont-map : (
arrow: "f063",
caret-down: “f0d7",
wordpress: “f19a",
);
@mixin icon( $icon ) {
font-family: “Icon Font”;
content: '#{map-get( $iconfont-map, $icon )}';
}
.my-list a {
&:before {
@include icon( arrow );
}
}
@mlteal | #WCPhilly | June 2015
Sass Frameworks
Utilize libraries & extensions
with Sass to get an even
more powerful preprocessor.
Many make built-in functions
available like transform() or
include their own grid systems.
• Compass
• Breakpoint
• Susy
• Bourbon
• Bootstrap
@mlteal | #WCPhilly | June 2015
Test Drive in a Project
Plugins:
Jetpack Custom CSS module: for adding custom CSS
directly on site
Admin Color Schemes: https://wordpress.org/plugins/
admin-color-schemes/
@mlteal | #WCPhilly | June 2015
Test Drive in a Project
Starter Themes:
Underscores: http://underscores.me/
Bones (need Compass): http://themble.com/bones/
Foundation: http://foundationpress.olefredrik.com/
Roots (now Sage): https://roots.io/sage/
Some Like it Neat: http://somelikeitneat.com/
@mlteal | #WCPhilly | June 2015
Workflows
Utilize task-based build tools (either
Grunt or Gulp) to watch and compile all
the things.
Config files make life easier, and
actively watch more than just your
stylesheets (think minifying JS and
more)
@mlteal | #WCPhilly | June 2015
Future & Performance
Ruby Sass - The original Sass we know & love

- Simple installation

- Lots of compatible frameworks

- Compiling can get slow on larger projects
LibSass - A C/C++ port of Sass

- Just a Sass library, so it needs a wrapper

- Not 100% caught up to Ruby Sass (but so close!)

- Stricter on syntax

- Much faster (up to 4000x)!
@mlteal | #WCPhilly | June 2015
Resources
Sass Documentation: 

http://sass-lang.com/documentation/file.SASS_REFERENCE.html
Codepen: http://codepen.io

Sassmeister: http://sassmeister.com
Underscores: http://underscores.me

Bones: http://themble.com/bones/
Ruby Sass vs LibSass: http://sassbreak.com/ruby-sass-libsass-differences/

Sass Compatibility Guide: http://sass-compatibility.github.io/

Weitere ähnliche Inhalte

Andere mochten auch

Getting SASSy with front end development
Getting SASSy with front end developmentGetting SASSy with front end development
Getting SASSy with front end developmentMatthew Carleton
 
SASS - Syntactically Awesome Stylesheet
SASS - Syntactically Awesome StylesheetSASS - Syntactically Awesome Stylesheet
SASS - Syntactically Awesome StylesheetNeha Sharma
 
Introduction to SASS
Introduction to SASSIntroduction to SASS
Introduction to SASSJon Dean
 
CSS3 secrets: 10 things you might not know about CSS3
CSS3 secrets: 10 things you might not know about CSS3CSS3 secrets: 10 things you might not know about CSS3
CSS3 secrets: 10 things you might not know about CSS3Lea Verou
 
Sass - Getting Started with Sass!
Sass - Getting Started with Sass!Sass - Getting Started with Sass!
Sass - Getting Started with Sass!Eric Sembrat
 

Andere mochten auch (7)

Getting SASSy with front end development
Getting SASSy with front end developmentGetting SASSy with front end development
Getting SASSy with front end development
 
SASS - Syntactically Awesome Stylesheet
SASS - Syntactically Awesome StylesheetSASS - Syntactically Awesome Stylesheet
SASS - Syntactically Awesome Stylesheet
 
Sass: Introduction
Sass: IntroductionSass: Introduction
Sass: Introduction
 
Introduction to SASS
Introduction to SASSIntroduction to SASS
Introduction to SASS
 
CSS3 secrets: 10 things you might not know about CSS3
CSS3 secrets: 10 things you might not know about CSS3CSS3 secrets: 10 things you might not know about CSS3
CSS3 secrets: 10 things you might not know about CSS3
 
Sass - Getting Started with Sass!
Sass - Getting Started with Sass!Sass - Getting Started with Sass!
Sass - Getting Started with Sass!
 
Fundamental CSS3
Fundamental CSS3Fundamental CSS3
Fundamental CSS3
 

Ähnlich wie Getting Started With Sass | WC Philly 2015

Advanced sass/compass
Advanced sass/compassAdvanced sass/compass
Advanced sass/compassNick Cooley
 
CSS Workflow. Pre & Post
CSS Workflow. Pre & PostCSS Workflow. Pre & Post
CSS Workflow. Pre & PostAnton Dosov
 
Branding SharePoint from Prototype to Deployment - Workshop
Branding SharePoint from Prototype to Deployment - WorkshopBranding SharePoint from Prototype to Deployment - Workshop
Branding SharePoint from Prototype to Deployment - WorkshopEric Overfield
 
Modern Front-End Development
Modern Front-End DevelopmentModern Front-End Development
Modern Front-End Developmentmwrather
 
Open Data Science Conference Big Data Infrastructure – Introduction to Hadoop...
Open Data Science Conference Big Data Infrastructure – Introduction to Hadoop...Open Data Science Conference Big Data Infrastructure – Introduction to Hadoop...
Open Data Science Conference Big Data Infrastructure – Introduction to Hadoop...DataKitchen
 
Brand Your Community Using Less and Gulp
Brand Your Community Using Less and GulpBrand Your Community Using Less and Gulp
Brand Your Community Using Less and GulpSalesforce Developers
 
Utilizing jQuery in SharePoint: Get More Done Faster
Utilizing jQuery in SharePoint: Get More Done FasterUtilizing jQuery in SharePoint: Get More Done Faster
Utilizing jQuery in SharePoint: Get More Done FasterMark Rackley
 
#SPSTC Maximizing the SharePoint User Experience with Free 3rd Party jQuery L...
#SPSTC Maximizing the SharePoint User Experience with Free 3rd Party jQuery L...#SPSTC Maximizing the SharePoint User Experience with Free 3rd Party jQuery L...
#SPSTC Maximizing the SharePoint User Experience with Free 3rd Party jQuery L...Mark Rackley
 
Jina bolton - Refactoring Web Interfaces
Jina bolton - Refactoring Web InterfacesJina bolton - Refactoring Web Interfaces
Jina bolton - Refactoring Web InterfacesDevConFu
 
Accessibility Hacks version 2
Accessibility Hacks version 2Accessibility Hacks version 2
Accessibility Hacks version 2Graham Armfield
 
Accessibility Hacks Version 2
Accessibility Hacks Version 2Accessibility Hacks Version 2
Accessibility Hacks Version 2Graham Armfield
 
Brand Your Community Using Less and Gulp
Brand Your Community Using Less and GulpBrand Your Community Using Less and Gulp
Brand Your Community Using Less and Gulpshujiui
 
Accessibility Hacks Wordcamp Manchester October 2018
Accessibility Hacks Wordcamp Manchester October 2018Accessibility Hacks Wordcamp Manchester October 2018
Accessibility Hacks Wordcamp Manchester October 2018Graham Armfield
 
Making your site printable: WordCamp Buffalo 2013
Making your site printable: WordCamp Buffalo 2013Making your site printable: WordCamp Buffalo 2013
Making your site printable: WordCamp Buffalo 2013Adrian Roselli
 
Building rednoseday.com on Drupal 8
Building rednoseday.com on Drupal 8Building rednoseday.com on Drupal 8
Building rednoseday.com on Drupal 8Peter Vanhee
 
Freelancer Weapons of mass productivity
Freelancer Weapons of mass productivityFreelancer Weapons of mass productivity
Freelancer Weapons of mass productivityGregg Coppen
 

Ähnlich wie Getting Started With Sass | WC Philly 2015 (20)

Advanced sass/compass
Advanced sass/compassAdvanced sass/compass
Advanced sass/compass
 
CSS Workflow. Pre & Post
CSS Workflow. Pre & PostCSS Workflow. Pre & Post
CSS Workflow. Pre & Post
 
Branding SharePoint from Prototype to Deployment - Workshop
Branding SharePoint from Prototype to Deployment - WorkshopBranding SharePoint from Prototype to Deployment - Workshop
Branding SharePoint from Prototype to Deployment - Workshop
 
CSS3
CSS3CSS3
CSS3
 
UNIT 3.ppt
UNIT 3.pptUNIT 3.ppt
UNIT 3.ppt
 
Modern Front-End Development
Modern Front-End DevelopmentModern Front-End Development
Modern Front-End Development
 
Open Data Science Conference Big Data Infrastructure – Introduction to Hadoop...
Open Data Science Conference Big Data Infrastructure – Introduction to Hadoop...Open Data Science Conference Big Data Infrastructure – Introduction to Hadoop...
Open Data Science Conference Big Data Infrastructure – Introduction to Hadoop...
 
Volunteer.rb
Volunteer.rbVolunteer.rb
Volunteer.rb
 
Brand Your Community Using Less and Gulp
Brand Your Community Using Less and GulpBrand Your Community Using Less and Gulp
Brand Your Community Using Less and Gulp
 
Utilizing jQuery in SharePoint: Get More Done Faster
Utilizing jQuery in SharePoint: Get More Done FasterUtilizing jQuery in SharePoint: Get More Done Faster
Utilizing jQuery in SharePoint: Get More Done Faster
 
#SPSTC Maximizing the SharePoint User Experience with Free 3rd Party jQuery L...
#SPSTC Maximizing the SharePoint User Experience with Free 3rd Party jQuery L...#SPSTC Maximizing the SharePoint User Experience with Free 3rd Party jQuery L...
#SPSTC Maximizing the SharePoint User Experience with Free 3rd Party jQuery L...
 
Jina bolton - Refactoring Web Interfaces
Jina bolton - Refactoring Web InterfacesJina bolton - Refactoring Web Interfaces
Jina bolton - Refactoring Web Interfaces
 
Accessibility Hacks version 2
Accessibility Hacks version 2Accessibility Hacks version 2
Accessibility Hacks version 2
 
Accessibility Hacks Version 2
Accessibility Hacks Version 2Accessibility Hacks Version 2
Accessibility Hacks Version 2
 
Brand Your Community Using Less and Gulp
Brand Your Community Using Less and GulpBrand Your Community Using Less and Gulp
Brand Your Community Using Less and Gulp
 
Accessibility Hacks Wordcamp Manchester October 2018
Accessibility Hacks Wordcamp Manchester October 2018Accessibility Hacks Wordcamp Manchester October 2018
Accessibility Hacks Wordcamp Manchester October 2018
 
Making your site printable: WordCamp Buffalo 2013
Making your site printable: WordCamp Buffalo 2013Making your site printable: WordCamp Buffalo 2013
Making your site printable: WordCamp Buffalo 2013
 
Team styles
Team stylesTeam styles
Team styles
 
Building rednoseday.com on Drupal 8
Building rednoseday.com on Drupal 8Building rednoseday.com on Drupal 8
Building rednoseday.com on Drupal 8
 
Freelancer Weapons of mass productivity
Freelancer Weapons of mass productivityFreelancer Weapons of mass productivity
Freelancer Weapons of mass productivity
 

Kürzlich hochgeladen

Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
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...Miguel Araújo
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
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...Drew Madelung
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
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 productivityPrincipled Technologies
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 

Kürzlich hochgeladen (20)

Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
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...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
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...
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
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
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 

Getting Started With Sass | WC Philly 2015

  • 1. @mlteal | #WCPhilly | June 2015 Getting Started with SASS or: All the things I wished for with CSS
  • 2. @mlteal | #WCPhilly | June 2015 Maura Teal Web Developer at FanSided @mlteal | mlteal.com
  • 3. @mlteal | #WCPhilly | June 2015 What is it? Syntactically Awesome StyleSheets A CSS pre-processor that allows us to use logic similar to real programming languages.
  • 4. @mlteal | #WCPhilly | June 2015 What do you get? More organization, sanity because variables, mixins, and functions. TL;DR: Build and adjust stylesheets efficiently.
  • 5. @mlteal | #WCPhilly | June 2015 How Does it Work? Watch your code while you work locally and continually compile into the CSS file you’ll use in your project.
  • 6. @mlteal | #WCPhilly | June 2015 Getting Started 1. Install Ruby 2. Install Sass Gem 3. Watch those files: Alternatively, download a GUI that takes care of things: Codekit ($) Koala (free) Scout (free) From the Command Line: cd path/to/my/sass/folder sass --watch input.scss:output.css Ctrl+C to stop watching
  • 7. @mlteal | #WCPhilly | June 2015 Just want to try it out? Codepen: http://codepen.io/ Sassmeister: http://sassmeister.com/
  • 8. @mlteal | #WCPhilly | June 2015 Features • Nesting • Variables • Mixins • Functions • Minification • Libraries To name a few…
  • 9. @mlteal | #WCPhilly | June 2015 Nesting Xzibit knows you like selectors
  • 10. @mlteal | #WCPhilly | June 2015 Nesting SASS .parent {
 blockquote, p {
 font-family: Times;
 }
 a {
 color: teal;
 }
 span {
 background: yellow;
 }
 } CSS .parent blockquote, 
 .parent p {
 font-family: Times;
 }
 .parent a {
 color: teal;
 }
 .parent span {
 background: yellow;
 }
  • 11. @mlteal | #WCPhilly | June 2015 Nesting a {
 color: teal;
 &.special {
 color: gold;
 }
 &:hover, 
 &:active {
 font-style: italic;
 }
 } a {
 color: teal;
 }
 a.special {
 color: gold;
 }
 a:hover, 
 a:active {
 font-style: italic;
 }
  • 12. @mlteal | #WCPhilly | June 2015 Variables $variable-name : /* variable properties here */; Think colors (hex values or rgba), fonts, sizes, or even previously defined vars: $fuchsia : #f0f; $border-style : 1px solid $fuchsia; $heading-size : 30px; $subheading-size : $heading-size / 2;
  • 13. @mlteal | #WCPhilly | June 2015 Variables 1. Define your color palette just this one time 
 $white : #FFFFFF;
 $teal : #27ba9a;
 $french-blue : #3196da;
 $purple : #9a58b5;
 $light-grey : #7e8c8d; 2. Abstract it in case all headings change from $purple to $teal someday $heading : $purple;
 $sub-heading : $white;
 $body-text : $light-grey;
 $link : $french-blue;
 $accent : $teal;
  • 14. @mlteal | #WCPhilly | June 2015 Mixins add candy to your code
  • 15. @mlteal | #WCPhilly | June 2015 Mixins Create reusable chunks of CSS @mixin border-radius($radius) { -moz-border-radius: $radius; -webkit-border-radius: $radius; border-radius: $radius; } .container { @include border-radius(18px); } .footer { @include border-radius(6px); } .container { -moz-border-radius: 18px; -webkit-border-radius: 18px; border-radius: 18px; } .footer { -moz-border-radius: 6px; -webkit-border-radius: 6px; border-radius: 6px; }
  • 16. @mlteal | #WCPhilly | June 2015 Functions Create reusable logic @function remy($pxsize) { @return: ($pxsize / 16 )+rem; } .container { font-size: remy(32); } .container { font-size: 2rem; } Ref: http://sass-lang.com/documentation/Sass/Script/Functions.html
  • 17. @mlteal | #WCPhilly | June 2015 Putting it all together Combining map-get() function with array maps $iconfont-map : ( arrow: "f063", caret-down: “f0d7", wordpress: “f19a", ); @mixin icon( $icon ) { font-family: “Icon Font”; content: '#{map-get( $iconfont-map, $icon )}'; } .my-list a { &:before { @include icon( arrow ); } }
  • 18. @mlteal | #WCPhilly | June 2015 Sass Frameworks Utilize libraries & extensions with Sass to get an even more powerful preprocessor. Many make built-in functions available like transform() or include their own grid systems. • Compass • Breakpoint • Susy • Bourbon • Bootstrap
  • 19. @mlteal | #WCPhilly | June 2015 Test Drive in a Project Plugins: Jetpack Custom CSS module: for adding custom CSS directly on site Admin Color Schemes: https://wordpress.org/plugins/ admin-color-schemes/
  • 20. @mlteal | #WCPhilly | June 2015 Test Drive in a Project Starter Themes: Underscores: http://underscores.me/ Bones (need Compass): http://themble.com/bones/ Foundation: http://foundationpress.olefredrik.com/ Roots (now Sage): https://roots.io/sage/ Some Like it Neat: http://somelikeitneat.com/
  • 21. @mlteal | #WCPhilly | June 2015 Workflows Utilize task-based build tools (either Grunt or Gulp) to watch and compile all the things. Config files make life easier, and actively watch more than just your stylesheets (think minifying JS and more)
  • 22. @mlteal | #WCPhilly | June 2015 Future & Performance Ruby Sass - The original Sass we know & love
 - Simple installation
 - Lots of compatible frameworks
 - Compiling can get slow on larger projects LibSass - A C/C++ port of Sass
 - Just a Sass library, so it needs a wrapper
 - Not 100% caught up to Ruby Sass (but so close!)
 - Stricter on syntax
 - Much faster (up to 4000x)!
  • 23. @mlteal | #WCPhilly | June 2015 Resources Sass Documentation: 
 http://sass-lang.com/documentation/file.SASS_REFERENCE.html Codepen: http://codepen.io
 Sassmeister: http://sassmeister.com Underscores: http://underscores.me
 Bones: http://themble.com/bones/ Ruby Sass vs LibSass: http://sassbreak.com/ruby-sass-libsass-differences/
 Sass Compatibility Guide: http://sass-compatibility.github.io/