SlideShare a Scribd company logo
YOOXlabs ~ 22.09.2015
andreaverlicchi.eu ~ @verlok ~ #YOOXlabsTechEvent
Agile CSS Development
with Compass / SASS
• Strong addiction to
front-end development
• Front-end Architect
• Occasional speaker
andreaverlicchi.eu ~ @verlok ~ #YOOXlabsTechEvent
YOOXlabs Tech Event
Front-End Development
October 2015
Agile CSS development with Compass and Sass
Language
Repetitive
Length
Mess?
Maintenance
Sass is the most mature, stable, and powerful
professional grade CSS extension language in the world.
How it works: locally
FILE .SCSS
FILE .CSS
WATCHGRUNT
How it works: CI
FILE .SCSS
COMPILE
FILE .CSS
button {
background: #ABCDEF;
}
a {
color: #ABCDEF;
}
header {
border-bottom: 5px;
border-color: #ABCDEF;
}
$mainColor: #ABCDEF;
button {
background: $mainColor;
}
a {
color: $mainColor;
}
header {
border-bottom: 5px;
border-color: $mainColor;
}
Variables
Nesting
article h1 {
margin-right: 1em;
}
article a {
color: white;
background: red;
display: block;
}
article a:hover {
color: red;
background: white;
}
article {
h1 {
margin-right: 1em;
}
a {
color: white;
background: red;
display: block;
&:hover {
color: red;
background: white;
}
}
}
Math
aside {
width: 23.95833%;
}
$width: 960px;
$asideWidth: 230px;
aside {
width: $asideWidth / $width * 100%;
}
Partials
@import “_variables”;
@import "_reset";
@import "_fonts";
@import "_headerFooter";
@import "_forms";
@import "_base";
@import "_helpers";
@import “_whatever”;
…
main.scss main.css
// _reset.scss
html, body, div, span, h1,
h2, h3, h4, h5, h6 … {
margin: 0; padding: 0; …
} // …
// _fonts.scss
@font-face {
font-family: myFont; //…
} // …
// …
// _whatever.scss
Helpers
button:hover {
background-color:

#A6CDF4;
}
button.disabled {
background-color:

#C4CDD6;
}
$buttonColor: #ABCDEF;
button:hover {
background-color: 

adjust-saturation($buttonColor, 10%);
}
button.disabled {
background-color: 

adjust-saturation($buttonColor, -10%);
}
Extend
.message {
font-weight: bold;
padding: 1em;
border-width: 2px;
}
.error {
@extend .message;
color: red;
border-color: red;
}
.alert {
@extend .message;
color: orange;
border-color: orange;
}
.message, .error, .alert {
font-weight: bold;
padding: 1em;
border-width: 2px;
}
.error {
color: red;
border-color: red;
}
.alert {
color: orange;
border-color: orange;
}
Extend
%message {
font-weight: bold;
padding: 1em;
border-width: 2px;
}
.error {
@extend %message;
color: red;
border-color: red;
}
.alert {
@extend %message;
color: orange;
border-color: orange;
}
.error, .alert {
font-weight: bold;
padding: 1em;
border-width: 2px;
}
.error {
color: red;
border-color: red;
}
.alert {
color: orange;
border-color: orange;
}
Mixins
@mixin message {
font-weight: bold;
padding: 1em;
border-width: 2px;
}
.error {
@include message;
color: red;
border-color: red;
}
.alert {
@include message;
color: orange;
border-color: orange;
}
.error {
font-weight: bold;
padding: 1em;
border-width: 2px;
color: red;
border-color: red;
}
.alert {
font-weight: bold;
padding: 1em;
border-width: 2px;
color: orange;
border-color: orange;
}
Extend vs Mixins
• CSS length
• Usage with media queries
• Parameters
EXTEND WINS
MIXIN WINS
MIXIN WINS
Mixins
@mixin opacity($opacity) {
opacity: $opacity;
filter: alpha(opacity=$opacity*100);
}
.faded-text {
@include opacity(0.8);
}
.faded-text {
opacity: 0.8;
filter: alpha(opacity=80);
}
Output style
• nested .widget-social {
text-align: right; }
.widget-social a,
.widget-social a:visited {
padding: 0 3px;
color: #222222; }
.widget-social a:hover {
color: #B00909; }
Output style
• nested
• expanded
.widget-social {
text-align: right;
}
.widget-social a,
.widget-social a:visited {
padding: 0 3px;
color: #222222;
}
.widget-social a:hover {
color: #B00909;
}
Output style
• nested
• expanded
• compact
.widget-social { text-align: right; }
.widget-social a, .widget-social a:visited { padding: 0 3px; … }
.widget-social a:hover { color: #B00909; }
Output style
• nested
• expanded
• compact
• compressed
.widget-social{text-align:right}.widget-social a,.widget-social
a:visited{padding:0 3px;color:#222222}.widget-social a:hover{co
lor:#B00909}
Debug
• source maps
• line comments
SASS
• Variables
• Nesting
• Math
• Partials
• Extend
• Mixins
Compass is an open-source CSS Authoring Framework.
Compass uses SASS.
Browser thresholds
Thresholds configuration
// Dichiarare prima di @import-are compass
$graceful-usage-threshold: 5; // def: 0.1
$critical-usage-threshold: 1; // def: 0.01
@import "compass/css3";
// Tutto il resto a seguire...
251 included mixing
Background & Gradients
.myBox {
@include background(linear-gradient(to bottom, #F00, #0F0));
}
.myBox {
// ...
background: -moz-linear-gradient(top, #ff0000, #00ff00);
background: -webkit-linear-gradient(top, #ff0000, #00ff00);
background: linear-gradient(to bottom, #ff0000, #00ff00);
}
Keyframes
@include keyframes(spin) {
from { transform: rotate(0); }
to { transform: rotate(360deg); }
}
@-moz-keyframes spin { ... }
@-webkit-keyframes spin { ... }
@keyframes spin {
from { transform: rotate(0); }
to { transform: rotate(360deg); }
}
Animation
.myBox {
@include animation(spin 1s);
}
.myBox {
-moz-animation: spin 1s;
-webkit-animation: spin 1s;
animation: spin 1s;
}
Flexbox
.parent {
@include display-flex;
@include flex-wrap(wrap);
}
.child {
@include flex-grow(1);
}
.parent {
display: -webkit-flex;
display: flex;
-webkit-flex-wrap: wrap;
flex-wrap: wrap;
}
.child {
-webkit-flex-grow: 1;
flex-grow: 1;
}
http://compass-style.org/index/mixins
Sprites
Sprites - All
@import “compass/utilities/sprites";
@import "flags/*.png";
@include all-flags-sprites;
.flags-it,
.flags-de,
.flags-fr {
background: url('/images/flags-s34fe0604ab.png') no-repeat;
}
.flags-it { background-position: 0 0; }
.flags-de { background-position: 0 -32px; }
.flags-fr { background-position: 0 -64px; }
// flags
// it.png
// de.png
// fr.png
Sprite - Single
@import "compass/utilities/sprites";
@import "flags/*.png";
// it.png
// de.png
.myBox {
@include flags-sprite(it);
}
.anotherBox {
@include flags-sprite(de);
}
.myBox,
.anotherBox {
background: url('../img/flags-
s69e070e3f8.png') no-repeat;
}
.myBox {
background-position: 0 0;
}
.anotherBox {
background-position: 0 -32px;
}
Sprite - Advanced
• Box size generation
• Offset inside the box
• Sprite images spacing
• Display density management
• Here’s how:

andreaverlicchi.eu/yooxlabs-2015-09/
Installation
• Download Ruby

rubyinstaller.org
• Install Compass
• Download Ruby

ruby-lang.com
• Install Compass
gem install compasssudo
Configuration
• Activate the project folder
• Create the configuration file
cd path/to/project
compass config --css-dir css
Primi file SASS
• Convert CSS to SCSS
sass-convert css/main.css --to scss
• Create initial folders and files
compass install compass
sass-convert css --to scss --recursive
Usage
• Compile
compass compile
• Start the watcher
compass watch
Compass
• Sprite
• Browser thresholds
• Included mixins
• Project organization
• Development speed
• Maintain with ease
Agile CSS development with Compass and Sass
Q&A
@verlok ~ #YOOXlabsTechEvent
SASS vs LESS
@verlok ~ #YOOXlabsTechEvent
https://css-tricks.com/sass-vs-less/
http://www.zingdesign.com/less-vs-sass-its-time-to-
switch-to-sass/

More Related Content

What's hot (20)

ODP
Sass presentation
Davin Abraham
 
PDF
The Future of CSS
elliando dias
 
KEY
Intro to SASS CSS
Kianosh Pourian
 
PPTX
Doing More With Less
David Engel
 
ODP
HTML5, CSS, JavaScript Style guide and coding conventions
Knoldus Inc.
 
PPT
Ppt ch05
niruttisai
 
PDF
CSS 開發加速指南-Sass & Compass
Lucien Lee
 
PDF
LESS, the CSS Preprocessor
Andrea Tarr
 
PDF
CSS3 3D Workshop
Christopher Schmitt
 
PDF
Intro to Sass for WordPress Developers
Suzette Franck
 
PPTX
BDUG Responsive Web Theming - 7/23/12
ucbdrupal
 
PDF
How to use CSS3 in WordPress
Suzette Franck
 
PDF
How to use CSS3 in WordPress - Sacramento
Suzette Franck
 
PDF
Sass and compass workshop
Shaho Toofani
 
PDF
Using LESS, the CSS Preprocessor: J and Beyond 2013
Andrea Tarr
 
PDF
Quality Development with CSS3
Shay Howe
 
PDF
The Future Of CSS
Andy Budd
 
PPTX
Sass presentation
Марко Ковачевић
 
PDF
LESS is More
jsmith92
 
Sass presentation
Davin Abraham
 
The Future of CSS
elliando dias
 
Intro to SASS CSS
Kianosh Pourian
 
Doing More With Less
David Engel
 
HTML5, CSS, JavaScript Style guide and coding conventions
Knoldus Inc.
 
Ppt ch05
niruttisai
 
CSS 開發加速指南-Sass & Compass
Lucien Lee
 
LESS, the CSS Preprocessor
Andrea Tarr
 
CSS3 3D Workshop
Christopher Schmitt
 
Intro to Sass for WordPress Developers
Suzette Franck
 
BDUG Responsive Web Theming - 7/23/12
ucbdrupal
 
How to use CSS3 in WordPress
Suzette Franck
 
How to use CSS3 in WordPress - Sacramento
Suzette Franck
 
Sass and compass workshop
Shaho Toofani
 
Using LESS, the CSS Preprocessor: J and Beyond 2013
Andrea Tarr
 
Quality Development with CSS3
Shay Howe
 
The Future Of CSS
Andy Budd
 
LESS is More
jsmith92
 

Similar to Agile CSS development with Compass and Sass (20)

PDF
Accelerated Stylesheets
Wynn Netherland
 
PDF
Sass and Compass - Getting Started
edgincvg
 
PDF
Keep calm and let's play CSS3
A2 Comunicação
 
PDF
Preprocessor presentation
Mario Noble
 
PDF
LESS : The dynamic stylesheet language
Katsunori Tanaka
 
PDF
Mobile-first OOCSS, Sass & Compass at BBC Responsive News
Kaelig Deloumeau-Prigent
 
PDF
Getting Started with Sass & Compass
Rob Davarnia
 
PDF
SASS, Compass, Gulp, Greensock
Marco Pinheiro
 
PDF
CSS Extenders
Idan Gazit
 
PDF
Workshop 6: Designer tools
Visual Engineering
 
PDF
HTML5 and CSS3 – exploring mobile possibilities - Frontend Conference Zürich
Robert Nyman
 
PDF
Sass & Compass (Barcamp Stuttgart 2012)
emrox
 
PDF
Big Design Conference: CSS3
Wynn Netherland
 
PDF
HTML5 and CSS3 – exploring mobile possibilities - Dynabyte event
Robert Nyman
 
KEY
Advanced sass/compass
Nick Cooley
 
KEY
Bringing sexy back to CSS: SASS/SCSS, LESS and Compass
Claudina Sarahe
 
PDF
CSS Less framework overview, Pros and Cons
Sanjoy Kr. Paul
 
PPTX
Raleigh Web Design Meetup Group - Sass Presentation
Daniel Yuschick
 
PDF
CSS3 Transforms Transitions and Animations
Inayaili León
 
PDF
Css3 and gwt in perfect harmony
jdramaix
 
Accelerated Stylesheets
Wynn Netherland
 
Sass and Compass - Getting Started
edgincvg
 
Keep calm and let's play CSS3
A2 Comunicação
 
Preprocessor presentation
Mario Noble
 
LESS : The dynamic stylesheet language
Katsunori Tanaka
 
Mobile-first OOCSS, Sass & Compass at BBC Responsive News
Kaelig Deloumeau-Prigent
 
Getting Started with Sass & Compass
Rob Davarnia
 
SASS, Compass, Gulp, Greensock
Marco Pinheiro
 
CSS Extenders
Idan Gazit
 
Workshop 6: Designer tools
Visual Engineering
 
HTML5 and CSS3 – exploring mobile possibilities - Frontend Conference Zürich
Robert Nyman
 
Sass & Compass (Barcamp Stuttgart 2012)
emrox
 
Big Design Conference: CSS3
Wynn Netherland
 
HTML5 and CSS3 – exploring mobile possibilities - Dynabyte event
Robert Nyman
 
Advanced sass/compass
Nick Cooley
 
Bringing sexy back to CSS: SASS/SCSS, LESS and Compass
Claudina Sarahe
 
CSS Less framework overview, Pros and Cons
Sanjoy Kr. Paul
 
Raleigh Web Design Meetup Group - Sass Presentation
Daniel Yuschick
 
CSS3 Transforms Transitions and Animations
Inayaili León
 
Css3 and gwt in perfect harmony
jdramaix
 
Ad

More from Andrea Verlicchi (7)

PDF
How and Why ($) to improve web performance.pdf
Andrea Verlicchi
 
PDF
Come e perché ($) migliorare le prestazioni web.pdf
Andrea Verlicchi
 
PPTX
Come e perché ($) migliorare le prestazioni web - Aprile 2023.pptx
Andrea Verlicchi
 
PDF
2022.04 - CSS Day IT - Images Optimisation 4.0
Andrea Verlicchi
 
PDF
Responsive images, an html 5.1 standard
Andrea Verlicchi
 
PDF
Sviluppo CSS agile con SASS e Compass - CSS Day 2015 Faenza
Andrea Verlicchi
 
PDF
Css3 transitions and animations + graceful degradation with jQuery
Andrea Verlicchi
 
How and Why ($) to improve web performance.pdf
Andrea Verlicchi
 
Come e perché ($) migliorare le prestazioni web.pdf
Andrea Verlicchi
 
Come e perché ($) migliorare le prestazioni web - Aprile 2023.pptx
Andrea Verlicchi
 
2022.04 - CSS Day IT - Images Optimisation 4.0
Andrea Verlicchi
 
Responsive images, an html 5.1 standard
Andrea Verlicchi
 
Sviluppo CSS agile con SASS e Compass - CSS Day 2015 Faenza
Andrea Verlicchi
 
Css3 transitions and animations + graceful degradation with jQuery
Andrea Verlicchi
 
Ad

Recently uploaded (20)

PPTX
The ARUBA Kind of new Proposal Umum .pptx
andiwarneri
 
PPTX
原版一样(ANU毕业证书)澳洲澳大利亚国立大学毕业证在线购买
Taqyea
 
PDF
web application development company in bangalore.pdf
https://dkpractice.co.in/seo.html tech
 
PPTX
原版一样(ISM毕业证书)德国多特蒙德国际管理学院毕业证多少钱
taqyed
 
PPT
Almos Entirely Correct Mixing with Apps to Voting
gapati2964
 
PDF
I Want to join occult brotherhood for money ritual#((+2347089754903))
haragonoccult
 
PDF
Slides: Eco Economic Epochs for The World Game (s) pdf
Steven McGee
 
PPTX
Class_4_Limbgvchgchgchgchgchgcjhgchgcnked_Lists.pptx
test123n
 
PDF
Beginning-Laravel-Build-Websites-with-Laravel-5.8-by-Sanjib-Sinha-z-lib.org.pdf
TagumLibuganonRiverB
 
PDF
ContextForge MCP Gateway - the missing proxy for AI Agents and Tools
Mihai Criveti
 
PPTX
My Mother At 66! (2).pptx00000000000000000000000000000
vedapattisiddharth
 
PDF
03 Internal Analysis Strategik Manajemen.pdf
AhmadRifaldhi
 
PDF
The Convergence of Threat Behaviors Across Intrusions
Joe Slowik
 
PPTX
Q1 English3 Week5 [email protected]
JenniferCawaling1
 
PDF
Transmission Control Protocol (TCP) and Starlink
APNIC
 
PDF
BroadLink Cloud Service introduction.pdf
DevendraDwivdi1
 
PPTX
BitRecover OST to PST Converter Software
antoniogosling01
 
PDF
B M Mostofa Kamal Al-Azad [Document & Localization Expert]
Mostofa Kamal Al-Azad
 
PDF
Materi tentang From Digital Economy to Fintech.pdf
Abdul Hakim
 
PDF
Clive Dickens RedTech Public Copy - Collaborate or Die
Clive Dickens
 
The ARUBA Kind of new Proposal Umum .pptx
andiwarneri
 
原版一样(ANU毕业证书)澳洲澳大利亚国立大学毕业证在线购买
Taqyea
 
web application development company in bangalore.pdf
https://dkpractice.co.in/seo.html tech
 
原版一样(ISM毕业证书)德国多特蒙德国际管理学院毕业证多少钱
taqyed
 
Almos Entirely Correct Mixing with Apps to Voting
gapati2964
 
I Want to join occult brotherhood for money ritual#((+2347089754903))
haragonoccult
 
Slides: Eco Economic Epochs for The World Game (s) pdf
Steven McGee
 
Class_4_Limbgvchgchgchgchgchgcjhgchgcnked_Lists.pptx
test123n
 
Beginning-Laravel-Build-Websites-with-Laravel-5.8-by-Sanjib-Sinha-z-lib.org.pdf
TagumLibuganonRiverB
 
ContextForge MCP Gateway - the missing proxy for AI Agents and Tools
Mihai Criveti
 
My Mother At 66! (2).pptx00000000000000000000000000000
vedapattisiddharth
 
03 Internal Analysis Strategik Manajemen.pdf
AhmadRifaldhi
 
The Convergence of Threat Behaviors Across Intrusions
Joe Slowik
 
Transmission Control Protocol (TCP) and Starlink
APNIC
 
BroadLink Cloud Service introduction.pdf
DevendraDwivdi1
 
BitRecover OST to PST Converter Software
antoniogosling01
 
B M Mostofa Kamal Al-Azad [Document & Localization Expert]
Mostofa Kamal Al-Azad
 
Materi tentang From Digital Economy to Fintech.pdf
Abdul Hakim
 
Clive Dickens RedTech Public Copy - Collaborate or Die
Clive Dickens
 

Agile CSS development with Compass and Sass

  • 1. YOOXlabs ~ 22.09.2015 andreaverlicchi.eu ~ @verlok ~ #YOOXlabsTechEvent Agile CSS Development with Compass / SASS
  • 2. • Strong addiction to front-end development • Front-end Architect • Occasional speaker andreaverlicchi.eu ~ @verlok ~ #YOOXlabsTechEvent
  • 3. YOOXlabs Tech Event Front-End Development October 2015
  • 10. Sass is the most mature, stable, and powerful professional grade CSS extension language in the world.
  • 11. How it works: locally FILE .SCSS FILE .CSS WATCHGRUNT
  • 12. How it works: CI FILE .SCSS COMPILE FILE .CSS
  • 13. button { background: #ABCDEF; } a { color: #ABCDEF; } header { border-bottom: 5px; border-color: #ABCDEF; } $mainColor: #ABCDEF; button { background: $mainColor; } a { color: $mainColor; } header { border-bottom: 5px; border-color: $mainColor; } Variables
  • 14. Nesting article h1 { margin-right: 1em; } article a { color: white; background: red; display: block; } article a:hover { color: red; background: white; } article { h1 { margin-right: 1em; } a { color: white; background: red; display: block; &:hover { color: red; background: white; } } }
  • 15. Math aside { width: 23.95833%; } $width: 960px; $asideWidth: 230px; aside { width: $asideWidth / $width * 100%; }
  • 16. Partials @import “_variables”; @import "_reset"; @import "_fonts"; @import "_headerFooter"; @import "_forms"; @import "_base"; @import "_helpers"; @import “_whatever”; … main.scss main.css // _reset.scss html, body, div, span, h1, h2, h3, h4, h5, h6 … { margin: 0; padding: 0; … } // … // _fonts.scss @font-face { font-family: myFont; //… } // … // … // _whatever.scss
  • 17. Helpers button:hover { background-color:
 #A6CDF4; } button.disabled { background-color:
 #C4CDD6; } $buttonColor: #ABCDEF; button:hover { background-color: 
 adjust-saturation($buttonColor, 10%); } button.disabled { background-color: 
 adjust-saturation($buttonColor, -10%); }
  • 18. Extend .message { font-weight: bold; padding: 1em; border-width: 2px; } .error { @extend .message; color: red; border-color: red; } .alert { @extend .message; color: orange; border-color: orange; } .message, .error, .alert { font-weight: bold; padding: 1em; border-width: 2px; } .error { color: red; border-color: red; } .alert { color: orange; border-color: orange; }
  • 19. Extend %message { font-weight: bold; padding: 1em; border-width: 2px; } .error { @extend %message; color: red; border-color: red; } .alert { @extend %message; color: orange; border-color: orange; } .error, .alert { font-weight: bold; padding: 1em; border-width: 2px; } .error { color: red; border-color: red; } .alert { color: orange; border-color: orange; }
  • 20. Mixins @mixin message { font-weight: bold; padding: 1em; border-width: 2px; } .error { @include message; color: red; border-color: red; } .alert { @include message; color: orange; border-color: orange; } .error { font-weight: bold; padding: 1em; border-width: 2px; color: red; border-color: red; } .alert { font-weight: bold; padding: 1em; border-width: 2px; color: orange; border-color: orange; }
  • 21. Extend vs Mixins • CSS length • Usage with media queries • Parameters EXTEND WINS MIXIN WINS MIXIN WINS
  • 22. Mixins @mixin opacity($opacity) { opacity: $opacity; filter: alpha(opacity=$opacity*100); } .faded-text { @include opacity(0.8); } .faded-text { opacity: 0.8; filter: alpha(opacity=80); }
  • 23. Output style • nested .widget-social { text-align: right; } .widget-social a, .widget-social a:visited { padding: 0 3px; color: #222222; } .widget-social a:hover { color: #B00909; }
  • 24. Output style • nested • expanded .widget-social { text-align: right; } .widget-social a, .widget-social a:visited { padding: 0 3px; color: #222222; } .widget-social a:hover { color: #B00909; }
  • 25. Output style • nested • expanded • compact .widget-social { text-align: right; } .widget-social a, .widget-social a:visited { padding: 0 3px; … } .widget-social a:hover { color: #B00909; }
  • 26. Output style • nested • expanded • compact • compressed .widget-social{text-align:right}.widget-social a,.widget-social a:visited{padding:0 3px;color:#222222}.widget-social a:hover{co lor:#B00909}
  • 27. Debug • source maps • line comments
  • 28. SASS • Variables • Nesting • Math • Partials • Extend • Mixins
  • 29. Compass is an open-source CSS Authoring Framework. Compass uses SASS.
  • 31. Thresholds configuration // Dichiarare prima di @import-are compass $graceful-usage-threshold: 5; // def: 0.1 $critical-usage-threshold: 1; // def: 0.01 @import "compass/css3"; // Tutto il resto a seguire...
  • 33. Background & Gradients .myBox { @include background(linear-gradient(to bottom, #F00, #0F0)); } .myBox { // ... background: -moz-linear-gradient(top, #ff0000, #00ff00); background: -webkit-linear-gradient(top, #ff0000, #00ff00); background: linear-gradient(to bottom, #ff0000, #00ff00); }
  • 34. Keyframes @include keyframes(spin) { from { transform: rotate(0); } to { transform: rotate(360deg); } } @-moz-keyframes spin { ... } @-webkit-keyframes spin { ... } @keyframes spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
  • 35. Animation .myBox { @include animation(spin 1s); } .myBox { -moz-animation: spin 1s; -webkit-animation: spin 1s; animation: spin 1s; }
  • 36. Flexbox .parent { @include display-flex; @include flex-wrap(wrap); } .child { @include flex-grow(1); } .parent { display: -webkit-flex; display: flex; -webkit-flex-wrap: wrap; flex-wrap: wrap; } .child { -webkit-flex-grow: 1; flex-grow: 1; }
  • 39. Sprites - All @import “compass/utilities/sprites"; @import "flags/*.png"; @include all-flags-sprites; .flags-it, .flags-de, .flags-fr { background: url('/images/flags-s34fe0604ab.png') no-repeat; } .flags-it { background-position: 0 0; } .flags-de { background-position: 0 -32px; } .flags-fr { background-position: 0 -64px; } // flags // it.png // de.png // fr.png
  • 40. Sprite - Single @import "compass/utilities/sprites"; @import "flags/*.png"; // it.png // de.png .myBox { @include flags-sprite(it); } .anotherBox { @include flags-sprite(de); } .myBox, .anotherBox { background: url('../img/flags- s69e070e3f8.png') no-repeat; } .myBox { background-position: 0 0; } .anotherBox { background-position: 0 -32px; }
  • 41. Sprite - Advanced • Box size generation • Offset inside the box • Sprite images spacing • Display density management • Here’s how:
 andreaverlicchi.eu/yooxlabs-2015-09/
  • 42. Installation • Download Ruby
 rubyinstaller.org • Install Compass • Download Ruby
 ruby-lang.com • Install Compass gem install compasssudo
  • 43. Configuration • Activate the project folder • Create the configuration file cd path/to/project compass config --css-dir css
  • 44. Primi file SASS • Convert CSS to SCSS sass-convert css/main.css --to scss • Create initial folders and files compass install compass sass-convert css --to scss --recursive
  • 45. Usage • Compile compass compile • Start the watcher compass watch
  • 46. Compass • Sprite • Browser thresholds • Included mixins
  • 47. • Project organization • Development speed • Maintain with ease
  • 50. SASS vs LESS @verlok ~ #YOOXlabsTechEvent https://css-tricks.com/sass-vs-less/ http://www.zingdesign.com/less-vs-sass-its-time-to- switch-to-sass/