SlideShare a Scribd company logo
Making CSS fun again :)
About
○ Front end developer at Conrad Caine
○ Analysis and development of systems at SENAC
This is my first presentation and everything can be boring...
                      so let's drink beer!
I will talk about
○ CSS weaknesses
○ Syntax
○ Features
○ Techniques
○ ...
CSS WEAKNESSES
What's wrong with CSS?
○ No variables
○ Prefixes
○ Lack of abstraction
○ Hard to maintain (mainly in big css files)
THE SOLUTION
CSS Preprocessors
○ Sass
○ Less
○ Stylus




            They are the most popular.
WHAT ARE CSS
PREPROCESSORS?
What are CSS Preprocessor?
"CSS preprocessors take code written in the preprocessed
language and then convert that code into the same old css
we’ve been writing for years."
STARTING WITH SASS
About
○ Syntactically Awesome StyleSheets
○ Sass makes CSS fun again
○ Sass get installed as Ruby gem, then you need to have
   Ruby on your machine.
Installing
gem install sass
The Process
○ Create a .scss file
○ Watch this .scss
○ Sass will create your .css
○ Be happy!
Watching a .scss file
sass --watch dev.scss:style.css
Output style
Sass allows you to choose between four different output
styles using the --style command-line flag.


sass --watch dev.scss:style.css   --style nested
sass --watch dev.scss:style.css   --style expanded
sass --watch dev.scss:style.css   --style compact
sass --watch dev.scss:style.css   --style compressed
VARIABLES
How can we do this today?
Variables
/* dev.scss */        /* output */
$width: 100px;        .side {
$color: #00214D;        width: 100px;
$size: 16px;          }

.side {               .bar {
  width: $width;        width: 100px;
}                       font-size: 16px;
                        color: #00214D;
.bar {                }
  width: $width;
  font-size: $size;
  color: $color;
}
Math operations
/* dev.scss */              /* output */
$width: 600px;              .nav li {
$length: 3;                   width: 200px;
                            }
.nav li {
  width: $width / $length
}
Color functions
/* dev.scss */                     /* output */
$color: #ce4dd6;                   .nav a {
                                     color: #e5a0e9;
                                   }
.nav a {
                                   .nav a:hover {
  color: lighten($color, 20%);       color: #d976e0;
  &:hover {                        }
    color: lighten($color, 10%);
  }
}
NESTING
We are accustomed to do this:
/* primate.css */
.nav li {
  list-style:none;
  float:left;
}

.nav li a {
  display:block;
  padding:5px;
}
Now we can do this:
/* dev.scss */          /* output */
.nav {                  .nav li {
  li {                    list-style: none;
                          float: left;
    list-style:none;
                        }
    float:left;
    a {                 .nav li a {
       display:block;     display: block;
       color:blue;        color: blue;
    }                   }
  }
}
Parent Reference
/* dev.scss */          /* output */
.nav {                  .nav li {
  li {                    list-style: none;
                          float: left;
    list-style:none;
                        }
    float:left;
    a {                 .nav li a {
       display:block;     display: block;
       color:blue;        color: blue;
       &:hover {        }
         color:red;
                        .nav li a:hover {
       }
                          display: block;
    }                     color: red;
  }                     }
}
MIXINS
Mixins
/* primate.css */
.nav li a {
  padding: 5px;
  border: 1px solid red;
  -moz-border-radius: 10px;
  -webkit-border-radius:
10px;
  border-radius: 10px;
}
Mixins
/* dev.scss */               /* output */
@mixin borderRadius {        .nav li a {
 -moz-border-radius: 10px;     padding: 5px;
                               border: 1px solid red;
 -webkit-border-radius:
10px;                          -moz-border-radius: 10px;
                               -webkit-border-radius:
 border-radius: 10px;        10px;
}                              border-radius: 10px;
                             }
.nav li a {
 padding: 5px;
 border: 1px solid red;
 @include borderRadius;
}
Arguments
/* dev.scss */            /* output */
@mixin title($size) {     article h2 {
  font: {                   font-family: arial;
                            font-size: 40px;
    family: arial;
                            font-weight: bold;
    size: $size;          }
    weight: bold;
  }
}

article h2 {
  @include title(40px);
}
INHERITANCE
Inheritance
/* dev.scss */              /* output */
.nav {                      .nav, .category {
   background: #CCC;          background: #CCC;
                              border: 1px solid red;
   border: 1px solid red;
                            }
}

.category {
   @extend .nav;
}
INTERPOLATION
Interpolation
/* dev.scss */            /* output */
$name: box;               p.box {
$attr: border;              border-color: blue;
                          }
p.#{$name} {
  #{$attr}-color: blue;
}
@import
@import




     core.css   fonts.css   reset.css   footer.css
@import
/* dev.scss */           /* output */
@import "reset.scss";
@import "fonts.scss";    /* reset */
@import "footer.scss";   html {}

                         /* fonts */
                         @font-face {}

                         /* footer */
                         footer {}
Control Directives
@if
/* dev.scss */                /* output */
$type: 'games';
                              p {
p {                             color: blue;
  @if $type == sports {       }
    color: green;
  }
  @else if $type == games {
    color: blue;
  }
  @else {
    color: red;
  }
}
@for
/* dev.scss */               /* output */
@for $i from 1 through 3 {   .item-1 {
  .item-#{$i} {                font-size: 12px;
                             }
    font-size: 12px * $i;
  }                          .item-2 {
}                              font-size: 24px;
                             }

                             .item-3 {
                               font-size: 36px;
                             }
@each
/* dev.scss */              /* output */
@each $type in a, b, c {    .a-icon {
  .#{$type}-icon {            background-image: url
                            ("/images/a.png");
    background-image: url
('/images/#{$type}.png');   }
  }                         .b-icon {
}                             background-image: url
                            ("/images/b.png");
                            }

                            .c-icon {
                              background-image: url
                            ("/images/c.png");
                            }
@while
/* dev.scss */                 /* output */
$i: 6;                         .item-6 {
@while $i > 0 {                  width: 12px;
                               }
  .item-#{$i} { width: 2px *
$i; }
                               .item-4 {
  $i: $i - 2;                    width: 8px;
}                              }

                               .item-2 {
                                 width: 4px;
                               }
Thank you!
○ gabrielneutzling@gmail.com
○ facebook.com/gneutzling
○ @gneutzling

More Related Content

What's hot

DBIx::Skinnyと仲間たち
DBIx::Skinnyと仲間たちDBIx::Skinnyと仲間たち
DBIx::Skinnyと仲間たち
Ryo Miyake
 
Make your own wp cli command in 10min
Make your own wp cli command in 10minMake your own wp cli command in 10min
Make your own wp cli command in 10min
Ivelina Dimova
 
Theming Ext JS 4
Theming Ext JS 4Theming Ext JS 4
Theming Ext JS 4
Sencha
 
Rapid Prototyping
Rapid PrototypingRapid Prototyping
Rapid Prototyping
Even Wu
 
CGI.pm - 3ло?!
CGI.pm - 3ло?!CGI.pm - 3ло?!
CGI.pm - 3ло?!
Anatoly Sharifulin
 
PhoneGap: Local Storage
PhoneGap: Local StoragePhoneGap: Local Storage
PhoneGap: Local Storage
Ivano Malavolta
 
SQL Injection Part 2
SQL Injection Part 2SQL Injection Part 2
SQL Injection Part 2
n|u - The Open Security Community
 
Sass 基礎教學 - 高雄前端社群(CSS 讀書會)
Sass 基礎教學 - 高雄前端社群(CSS 讀書會)Sass 基礎教學 - 高雄前端社群(CSS 讀書會)
Sass 基礎教學 - 高雄前端社群(CSS 讀書會)
Chih-cheng Wang
 
CSS3 Refresher
CSS3 RefresherCSS3 Refresher
CSS3 Refresher
Ivano Malavolta
 
Jina Bolton
Jina BoltonJina Bolton
Jina Bolton
Carsonified Team
 
JSON Schema in Web Frontend #insideFE
JSON Schema in Web Frontend #insideFEJSON Schema in Web Frontend #insideFE
JSON Schema in Web Frontend #insideFE
Hiroyuki Anai
 
Google Cloud Challenge - PHP - DevFest GDG-Cairo
Google Cloud Challenge - PHP - DevFest GDG-Cairo Google Cloud Challenge - PHP - DevFest GDG-Cairo
Google Cloud Challenge - PHP - DevFest GDG-Cairo
Haitham Nabil
 
CSSプリプロセッサの取扱説明書
CSSプリプロセッサの取扱説明書CSSプリプロセッサの取扱説明書
CSSプリプロセッサの取扱説明書
拓樹 谷
 
Auto tools
Auto toolsAuto tools
Auto tools
祺 周
 
Shortcodes In-Depth
Shortcodes In-DepthShortcodes In-Depth
Shortcodes In-Depth
Micah Wood
 
R57php 1231677414471772-2
R57php 1231677414471772-2R57php 1231677414471772-2
R57php 1231677414471772-2
ady36
 
Bouncingballs sh
Bouncingballs shBouncingballs sh
Bouncingballs sh
Ben Pope
 
Mojolicious: what works and what doesn't
Mojolicious: what works and what doesn'tMojolicious: what works and what doesn't
Mojolicious: what works and what doesn't
Cosimo Streppone
 
Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)
Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)
Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)
Dotan Dimet
 

What's hot (19)

DBIx::Skinnyと仲間たち
DBIx::Skinnyと仲間たちDBIx::Skinnyと仲間たち
DBIx::Skinnyと仲間たち
 
Make your own wp cli command in 10min
Make your own wp cli command in 10minMake your own wp cli command in 10min
Make your own wp cli command in 10min
 
Theming Ext JS 4
Theming Ext JS 4Theming Ext JS 4
Theming Ext JS 4
 
Rapid Prototyping
Rapid PrototypingRapid Prototyping
Rapid Prototyping
 
CGI.pm - 3ло?!
CGI.pm - 3ло?!CGI.pm - 3ло?!
CGI.pm - 3ло?!
 
PhoneGap: Local Storage
PhoneGap: Local StoragePhoneGap: Local Storage
PhoneGap: Local Storage
 
SQL Injection Part 2
SQL Injection Part 2SQL Injection Part 2
SQL Injection Part 2
 
Sass 基礎教學 - 高雄前端社群(CSS 讀書會)
Sass 基礎教學 - 高雄前端社群(CSS 讀書會)Sass 基礎教學 - 高雄前端社群(CSS 讀書會)
Sass 基礎教學 - 高雄前端社群(CSS 讀書會)
 
CSS3 Refresher
CSS3 RefresherCSS3 Refresher
CSS3 Refresher
 
Jina Bolton
Jina BoltonJina Bolton
Jina Bolton
 
JSON Schema in Web Frontend #insideFE
JSON Schema in Web Frontend #insideFEJSON Schema in Web Frontend #insideFE
JSON Schema in Web Frontend #insideFE
 
Google Cloud Challenge - PHP - DevFest GDG-Cairo
Google Cloud Challenge - PHP - DevFest GDG-Cairo Google Cloud Challenge - PHP - DevFest GDG-Cairo
Google Cloud Challenge - PHP - DevFest GDG-Cairo
 
CSSプリプロセッサの取扱説明書
CSSプリプロセッサの取扱説明書CSSプリプロセッサの取扱説明書
CSSプリプロセッサの取扱説明書
 
Auto tools
Auto toolsAuto tools
Auto tools
 
Shortcodes In-Depth
Shortcodes In-DepthShortcodes In-Depth
Shortcodes In-Depth
 
R57php 1231677414471772-2
R57php 1231677414471772-2R57php 1231677414471772-2
R57php 1231677414471772-2
 
Bouncingballs sh
Bouncingballs shBouncingballs sh
Bouncingballs sh
 
Mojolicious: what works and what doesn't
Mojolicious: what works and what doesn'tMojolicious: what works and what doesn't
Mojolicious: what works and what doesn't
 
Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)
Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)
Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)
 

Similar to Sass - Making CSS fun again.

Mobile-first OOCSS, Sass & Compass at BBC Responsive News
Mobile-first OOCSS, Sass & Compass at BBC Responsive NewsMobile-first OOCSS, Sass & Compass at BBC Responsive News
Mobile-first OOCSS, Sass & Compass at BBC Responsive News
Kaelig Deloumeau-Prigent
 
CSS Extenders
CSS ExtendersCSS Extenders
CSS Extenders
Idan Gazit
 
Wrangling the CSS Beast with Sass
Wrangling the CSS Beast  with SassWrangling the CSS Beast  with Sass
Wrangling the CSS Beast with Sass
Rob Friesel
 
Work and play with SASS & Compass
Work and play with SASS & CompassWork and play with SASS & Compass
Work and play with SASS & Compass
Andreas Dantz
 
Sass&compass
Sass&compassSass&compass
Sass&compass
Min Jun Kim
 
Theming and Sass
Theming and SassTheming and Sass
Theming and Sass
James Pearce
 
Css frameworks
Css frameworksCss frameworks
Css frameworks
Dimitar Belchugov
 
Sencha Touch
Sencha TouchSencha Touch
Sencha Touch
Craig Walker
 
Software programming tools for creating/managing CSS files
Software programming tools for creating/managing CSS filesSoftware programming tools for creating/managing CSS files
Software programming tools for creating/managing CSS files
Dinu Suman
 
Preprocessor presentation
Preprocessor presentationPreprocessor presentation
Preprocessor presentation
Mario Noble
 
Curso CSS3 com Sass e Compass - Aula 01 - Introducão
Curso CSS3 com Sass e Compass - Aula 01 - IntroducãoCurso CSS3 com Sass e Compass - Aula 01 - Introducão
Curso CSS3 com Sass e Compass - Aula 01 - Introducão
Loiane Groner
 
Accelerated Stylesheets
Accelerated StylesheetsAccelerated Stylesheets
Accelerated Stylesheets
Wynn Netherland
 
Less & Sass
Less & SassLess & 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
Claudina Sarahe
 
Sass and Compass - Getting Started
Sass and Compass - Getting StartedSass and Compass - Getting Started
Sass and Compass - Getting Started
edgincvg
 
LessCSS Presentation @ April 2015 GTALUG Meeting
LessCSS Presentation @ April 2015 GTALUG MeetingLessCSS Presentation @ April 2015 GTALUG Meeting
LessCSS Presentation @ April 2015 GTALUG Meeting
Myles Braithwaite
 
Finding a Better Way to CSS: Navigating Sass with Compass
Finding a Better Way to CSS: Navigating Sass with CompassFinding a Better Way to CSS: Navigating Sass with Compass
Finding a Better Way to CSS: Navigating Sass with Compass
Claudina Sarahe
 
Doing more with LESS
Doing more with LESSDoing more with LESS
Doing more with LESS
jsmith92
 
Getting Started with Sass & Compass
Getting Started with Sass & CompassGetting Started with Sass & Compass
Getting Started with Sass & Compass
Rob Davarnia
 
Ext js saas&compass
Ext js saas&compassExt js saas&compass
Ext js saas&compass
elitonweb
 

Similar to Sass - Making CSS fun again. (20)

Mobile-first OOCSS, Sass & Compass at BBC Responsive News
Mobile-first OOCSS, Sass & Compass at BBC Responsive NewsMobile-first OOCSS, Sass & Compass at BBC Responsive News
Mobile-first OOCSS, Sass & Compass at BBC Responsive News
 
CSS Extenders
CSS ExtendersCSS Extenders
CSS Extenders
 
Wrangling the CSS Beast with Sass
Wrangling the CSS Beast  with SassWrangling the CSS Beast  with Sass
Wrangling the CSS Beast with Sass
 
Work and play with SASS & Compass
Work and play with SASS & CompassWork and play with SASS & Compass
Work and play with SASS & Compass
 
Sass&compass
Sass&compassSass&compass
Sass&compass
 
Theming and Sass
Theming and SassTheming and Sass
Theming and Sass
 
Css frameworks
Css frameworksCss frameworks
Css frameworks
 
Sencha Touch
Sencha TouchSencha Touch
Sencha Touch
 
Software programming tools for creating/managing CSS files
Software programming tools for creating/managing CSS filesSoftware programming tools for creating/managing CSS files
Software programming tools for creating/managing CSS files
 
Preprocessor presentation
Preprocessor presentationPreprocessor presentation
Preprocessor presentation
 
Curso CSS3 com Sass e Compass - Aula 01 - Introducão
Curso CSS3 com Sass e Compass - Aula 01 - IntroducãoCurso CSS3 com Sass e Compass - Aula 01 - Introducão
Curso CSS3 com Sass e Compass - Aula 01 - Introducão
 
Accelerated Stylesheets
Accelerated StylesheetsAccelerated Stylesheets
Accelerated Stylesheets
 
Less & Sass
Less & SassLess & Sass
Less & 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
 
Sass and Compass - Getting Started
Sass and Compass - Getting StartedSass and Compass - Getting Started
Sass and Compass - Getting Started
 
LessCSS Presentation @ April 2015 GTALUG Meeting
LessCSS Presentation @ April 2015 GTALUG MeetingLessCSS Presentation @ April 2015 GTALUG Meeting
LessCSS Presentation @ April 2015 GTALUG Meeting
 
Finding a Better Way to CSS: Navigating Sass with Compass
Finding a Better Way to CSS: Navigating Sass with CompassFinding a Better Way to CSS: Navigating Sass with Compass
Finding a Better Way to CSS: Navigating Sass with Compass
 
Doing more with LESS
Doing more with LESSDoing more with LESS
Doing more with LESS
 
Getting Started with Sass & Compass
Getting Started with Sass & CompassGetting Started with Sass & Compass
Getting Started with Sass & Compass
 
Ext js saas&compass
Ext js saas&compassExt js saas&compass
Ext js saas&compass
 

Recently uploaded

Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
Edge AI and Vision Alliance
 
JavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green MasterplanJavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green Masterplan
Miro Wengner
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
Tatiana Kojar
 
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframeDigital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Precisely
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
Antonios Katsarakis
 
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-EfficiencyFreshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
ScyllaDB
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
saastr
 
"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota
Fwdays
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Tosin Akinosho
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
saastr
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving
 
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and BioinformaticiansBiomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Neo4j
 
Mutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented ChatbotsMutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented Chatbots
Pablo Gómez Abajo
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Alpen-Adria-Universität
 

Recently uploaded (20)

Artificial Intelligence and Electronic Warfare
Artificial Intelligence and Electronic WarfareArtificial Intelligence and Electronic Warfare
Artificial Intelligence and Electronic Warfare
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
 
JavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green MasterplanJavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green Masterplan
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
 
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframeDigital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
 
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-EfficiencyFreshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
 
"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024
 
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and BioinformaticiansBiomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
 
Mutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented ChatbotsMutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented Chatbots
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
 

Sass - Making CSS fun again.

  • 1. Making CSS fun again :)
  • 2. About ○ Front end developer at Conrad Caine ○ Analysis and development of systems at SENAC
  • 3. This is my first presentation and everything can be boring... so let's drink beer!
  • 4. I will talk about ○ CSS weaknesses ○ Syntax ○ Features ○ Techniques ○ ...
  • 6. What's wrong with CSS? ○ No variables ○ Prefixes ○ Lack of abstraction ○ Hard to maintain (mainly in big css files)
  • 8. CSS Preprocessors ○ Sass ○ Less ○ Stylus They are the most popular.
  • 10. What are CSS Preprocessor? "CSS preprocessors take code written in the preprocessed language and then convert that code into the same old css we’ve been writing for years."
  • 12. About ○ Syntactically Awesome StyleSheets ○ Sass makes CSS fun again ○ Sass get installed as Ruby gem, then you need to have Ruby on your machine.
  • 14. The Process ○ Create a .scss file ○ Watch this .scss ○ Sass will create your .css ○ Be happy!
  • 15. Watching a .scss file sass --watch dev.scss:style.css
  • 16. Output style Sass allows you to choose between four different output styles using the --style command-line flag. sass --watch dev.scss:style.css --style nested sass --watch dev.scss:style.css --style expanded sass --watch dev.scss:style.css --style compact sass --watch dev.scss:style.css --style compressed
  • 18. How can we do this today?
  • 19. Variables /* dev.scss */ /* output */ $width: 100px; .side { $color: #00214D; width: 100px; $size: 16px; } .side { .bar { width: $width; width: 100px; } font-size: 16px; color: #00214D; .bar { } width: $width; font-size: $size; color: $color; }
  • 20. Math operations /* dev.scss */ /* output */ $width: 600px; .nav li { $length: 3; width: 200px; } .nav li { width: $width / $length }
  • 21. Color functions /* dev.scss */ /* output */ $color: #ce4dd6; .nav a { color: #e5a0e9; } .nav a { .nav a:hover { color: lighten($color, 20%); color: #d976e0; &:hover { } color: lighten($color, 10%); } }
  • 23. We are accustomed to do this: /* primate.css */ .nav li { list-style:none; float:left; } .nav li a { display:block; padding:5px; }
  • 24. Now we can do this: /* dev.scss */ /* output */ .nav { .nav li { li { list-style: none; float: left; list-style:none; } float:left; a { .nav li a { display:block; display: block; color:blue; color: blue; } } } }
  • 25. Parent Reference /* dev.scss */ /* output */ .nav { .nav li { li { list-style: none; float: left; list-style:none; } float:left; a { .nav li a { display:block; display: block; color:blue; color: blue; &:hover { } color:red; .nav li a:hover { } display: block; } color: red; } } }
  • 27. Mixins /* primate.css */ .nav li a { padding: 5px; border: 1px solid red; -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px; }
  • 28. Mixins /* dev.scss */ /* output */ @mixin borderRadius { .nav li a { -moz-border-radius: 10px; padding: 5px; border: 1px solid red; -webkit-border-radius: 10px; -moz-border-radius: 10px; -webkit-border-radius: border-radius: 10px; 10px; } border-radius: 10px; } .nav li a { padding: 5px; border: 1px solid red; @include borderRadius; }
  • 29. Arguments /* dev.scss */ /* output */ @mixin title($size) { article h2 { font: { font-family: arial; font-size: 40px; family: arial; font-weight: bold; size: $size; } weight: bold; } } article h2 { @include title(40px); }
  • 31. Inheritance /* dev.scss */ /* output */ .nav { .nav, .category { background: #CCC; background: #CCC; border: 1px solid red; border: 1px solid red; } } .category { @extend .nav; }
  • 33. Interpolation /* dev.scss */ /* output */ $name: box; p.box { $attr: border; border-color: blue; } p.#{$name} { #{$attr}-color: blue; }
  • 35. @import core.css fonts.css reset.css footer.css
  • 36. @import /* dev.scss */ /* output */ @import "reset.scss"; @import "fonts.scss"; /* reset */ @import "footer.scss"; html {} /* fonts */ @font-face {} /* footer */ footer {}
  • 38. @if /* dev.scss */ /* output */ $type: 'games'; p { p { color: blue; @if $type == sports { } color: green; } @else if $type == games { color: blue; } @else { color: red; } }
  • 39. @for /* dev.scss */ /* output */ @for $i from 1 through 3 { .item-1 { .item-#{$i} { font-size: 12px; } font-size: 12px * $i; } .item-2 { } font-size: 24px; } .item-3 { font-size: 36px; }
  • 40. @each /* dev.scss */ /* output */ @each $type in a, b, c { .a-icon { .#{$type}-icon { background-image: url ("/images/a.png"); background-image: url ('/images/#{$type}.png'); } } .b-icon { } background-image: url ("/images/b.png"); } .c-icon { background-image: url ("/images/c.png"); }
  • 41. @while /* dev.scss */ /* output */ $i: 6; .item-6 { @while $i > 0 { width: 12px; } .item-#{$i} { width: 2px * $i; } .item-4 { $i: $i - 2; width: 8px; } } .item-2 { width: 4px; }
  • 42. Thank you! ○ gabrielneutzling@gmail.com ○ facebook.com/gneutzling ○ @gneutzling