SlideShare ist ein Scribd-Unternehmen logo
1 von 34
Downloaden Sie, um offline zu lesen
Save time by using SASS
 Structured CSS with SASS and sassify
Berit Jensen
■ Frontend Developer,
 Certified TYPO3 Integrator
 at networkteam GmbH

■ TYPO3Phoenix Core
 Team Member

■ TYPO3Marketing Team
 Member
CSS - The bad parts
Mixed up formatting
Duplication
Mixed up colors and dimensions
Long selectors
Imports are slow!
SASS
 SCSS
Compiler

SCSS


  SCSS
                      CSS




SCSS will be compiled to CSS
CSS                  SCSS




You can simply copy existing CSS
CSS Enhancements
#header {                                 #header {
    ...                                       ...
}                                             ul.menu {
#header ul.menu li a {                            ...
    ...                                           li {
}                                                     ...
#header ul.menu li {                                  a{
    ...                        refactor                   ...
}                                                     }
li a {                                    }
    ...                                   li a {
}                                             ...
#header ul.menu {                         }
    ...
}
                         CSS                                    SCSS



                           Nesting
#header ul.menu li a {                    #header {
  color: #000;                              ul.menu {
}                                              li {
#header ul.menu li a:hover {                       a{
  color: #ccc;                                       color: #000;
}                                                    &:hover {
                                                       color: #ccc;
                               refactor              }
                                                   }
                                          }




                         CSS                                          SCSS



              Selector references
$grey: #c7c7c7;
                                                   $border-size: solid 1px;
                                                   $border: $border-size $grey;
#menu {                                            #menu {
  ...                                                ...
  border-left: solid 1px #c7c7c7;                    border-left: $border;
  border-top: solid 1px #c7c7c7;                     border-top: $border;
  border-right: solid 1px #c7c7c7;                   border-right: $border;
}                                       refactor   }
#rootline {                                        #rootline {
  ...                                                ...
  background-color: #c7c7c7;                         background-color: $grey;
}                                                  }
#content {                                         #content {
  ...                                                ...
  border-left: solid 1px #c7c7c7;                    border-left: $border;
  border-top: solid 1px #c7c7c7;                     border-top: $border;
  border-right: solid 1px #c7c7c7;                   border-right: $border;
}                                 CSS              }                              SCSS


                                Variables
$total-width: 600px;
                                         $sidebar-width: 100px;
                                         $spacing: 20px;

#content {                               #content {
  width: 500px;                            width: $total-width - $sidebar-width;
  padding: 40px;                           padding: $spacing * 2;
}                                        }
#sidebar {                    refactor   #sidebar {
  width: 100px;                            width: $sidebar-width;
  margin-left: 20px;                       margin-left: $spacing;
}                                        }




                        CSS                                                SCSS


                       Calculations
$color: #777777;                                     #content {
                                           compile    background-color: #444444; }
#content {
  background-color: darken($color, 20%);             h2 {
}                                                     color: #f6f6f6; }
h2 {
  color: lighten($color, 50%);
}




                                   SCSS




                            Functions (predefined)
Functions
                           http://sass-lang.com/docs/yardoc/Sass/Script/Functions.html

adjust_hue(color, degrees)               alpha(color)                                    percentage(value)
complement(color)                        blue(color)                                     unit(number)
darken(color, amount)                    green(color)                                    unitless(number)
desaturate(color, amount)                hue(color)
grayscale(color)                         red(color)                                      quote(str)
lighten(color, amount)                   opacity(color)                                  unquote(str)
mix(color1, color2, weight)              lightness(color)
opacify(color, amount)                   saturation(color)
saturate(color, amount)
transparentize(color, amount)            abs(value)
                                         ceil(value)
hsl(hue, saturation, lightness)          floor(value)
hsla(hue, saturation, lightness,         round(value)
alpha)
rgb(red, green, blue)                    comparable(number1, number2)
rgba(red, green, blue, alpha)            type_of(obj)
rgba(color, alpha)
@mixin rounded-border {                               .rounded-box {
     border-radius: 4px;                                border-radius: 4px;
     -moz-border-radius: 4px;                           -moz-border-radius: 4px;
     -webkit-border-radius: 4px;                        -webkit-border-radius: 4px;
}                                                       width: 250px; }
.rounded-box {                                        #navigation ul li {
   @include rounded-border;                               border-radius: 4px;
   width: 250px;                                         -moz-border-radius: 4px;
                                            compile
}                                                        -webkit-border-radius: 4px; }
#navigation {
   ul {
      li {
          @include rounded-border;
      }
   }
}

                                     SCSS                                                CSS


                                        Mixins
@mixin rounded-border($radius) {                    .rounded-box {
     border-radius: $radius;                          border-radius: 4px;
     -moz-border-radius: $radius;                     -moz-border-radius: 4px;
     -webkit-border-radius: $radius;                  -webkit-border-radius: 4px;
}                                                     width: 250px; }
.rounded-box {                                      #navigation ul li {
   @include rounded-border(4px);                        border-radius: 2px;
   width: 250px;                                       -moz-border-radius: 2px;
                                          compile
}                                                      -webkit-border-radius: 2px; }
#navigation {
   ul {
      li {
          @include rounded-border(2px);
      }
   }
}

                                   SCSS                                                CSS


                    Mixins with arguments
$color = #cc7700;                                      #inhalt {
                                             compile    background-color: #663c00; }
@import "a.scss";
@import "b.scss";                                      h2 {
                                 SCSS                   color: #cc7700; }

  #inhalt {
    background-color: darken($color, 20%);
  }

                                    a.scss

  h2 {
    color: $color;
  }
                                    b.scss                                             CSS




                              Real Imports
$type: business;                                    p{
p{                                        compile    color: green; }
  @if $type == ocean {
    color: blue;
  } @else if $type == matador {
    color: red;
  } @else if $type == business {
    color: green;
  } @else {
    color: black;
  }
}



                                   SCSS                                CSS




                     Control structures / if
@for $i from 1 through 3 {                          h1 {
  h#{$i} {                                compile    font-size: 0.8em; }
    font-size: 1em - (0.2 * $i);
  }                                                 h2 {
}                                                    font-size: 0.6em; }

                                                    h3 {
                                                     font-size: 0.4em; }




                                   SCSS                                    CSS




                     Control structures / for
/*                                               /*
 * Multiline CSS Comment               compile    * Multiline CSS Comment
 */                                               */
body { color: black; }                           body {
                                                   color: black; }
// One-line, internal comment
a { color: green }                               a{
                                                  color: green; }




                                SCSS                                        CSS




                                Comments
Installation & Usage
Installation
■ RubyInstaller (http://www.ruby-lang.org/de/downloads/)

■ Install
       the SASS Gem:
  sudo gem install sass --pre
■ or   the PHP version PHamlP
  (http://code.google.com/p/phamlp)
sass --watch imports.scss




Watch your changes
Debugging
sass -g imports.scss > imports.css




          FireSass
       Firebug Extension
SASS Framework
http://compass-style.org
sassify
               TYPO3 Extension based on PHamlP
http://typo3.org/documentation/document-library/extension-manuals/sassify/1.0.1/view
Reality Check
Thank You!
Questions?

Weitere ähnliche Inhalte

Andere mochten auch

Running with emmet and scss
Running with emmet  and scssRunning with emmet  and scss
Running with emmet and scssAaron King
 
Cloud Computing Bootcamp On The Google App Engine [v1.1]
Cloud Computing Bootcamp On The Google App Engine [v1.1]Cloud Computing Bootcamp On The Google App Engine [v1.1]
Cloud Computing Bootcamp On The Google App Engine [v1.1]Matthew McCullough
 
Google App Engine and Social Apps
Google App Engine and Social AppsGoogle App Engine and Social Apps
Google App Engine and Social AppsChris Schalk
 
Sassy Stylesheets with SCSS
Sassy Stylesheets with SCSSSassy Stylesheets with SCSS
Sassy Stylesheets with SCSSKathryn Rotondo
 
Scalable Apps with Google App Engine
Scalable Apps with Google App EngineScalable Apps with Google App Engine
Scalable Apps with Google App EngineDavid Chandler
 
GDD Brazil 2010 - What's new in Google App Engine and Google App Engine For B...
GDD Brazil 2010 - What's new in Google App Engine and Google App Engine For B...GDD Brazil 2010 - What's new in Google App Engine and Google App Engine For B...
GDD Brazil 2010 - What's new in Google App Engine and Google App Engine For B...Patrick Chanezon
 
Developing Java Web Applications In Google App Engine
Developing Java Web Applications In Google App EngineDeveloping Java Web Applications In Google App Engine
Developing Java Web Applications In Google App EngineTahir Akram
 
Turbo theming: Introduction to Sass & Compass
Turbo theming: Introduction to Sass & CompassTurbo theming: Introduction to Sass & Compass
Turbo theming: Introduction to Sass & CompassAlmog Baku
 
Stylesheet Wrangling with SCSS
Stylesheet Wrangling with SCSSStylesheet Wrangling with SCSS
Stylesheet Wrangling with SCSSsforst
 
Front End Badassery with Sass
Front End Badassery with SassFront End Badassery with Sass
Front End Badassery with Sassjessabean
 
Frontend-Entwicklung mit SASS & Compass
Frontend-Entwicklung mit SASS & CompassFrontend-Entwicklung mit SASS & Compass
Frontend-Entwicklung mit SASS & CompassAndreas Dantz
 
Preprocessor presentation
Preprocessor presentationPreprocessor presentation
Preprocessor presentationMario Noble
 
Performance front end language
Performance front end languagePerformance front end language
Performance front end languageWei-Yi Chiu
 
老成的Sass&Compass
老成的Sass&Compass老成的Sass&Compass
老成的Sass&Compass智遠 成
 
Getting Started with Sass & Compass
Getting Started with Sass & CompassGetting Started with Sass & Compass
Getting Started with Sass & CompassRob Davarnia
 
10 Things You Need To Know About Digital CIOs
10 Things You Need To Know About Digital CIOs10 Things You Need To Know About Digital CIOs
10 Things You Need To Know About Digital CIOsCognizant
 

Andere mochten auch (20)

Sass(SCSS)について
Sass(SCSS)についてSass(SCSS)について
Sass(SCSS)について
 
Css to-scss
Css to-scssCss to-scss
Css to-scss
 
Running with emmet and scss
Running with emmet  and scssRunning with emmet  and scss
Running with emmet and scss
 
Cloud Computing Bootcamp On The Google App Engine [v1.1]
Cloud Computing Bootcamp On The Google App Engine [v1.1]Cloud Computing Bootcamp On The Google App Engine [v1.1]
Cloud Computing Bootcamp On The Google App Engine [v1.1]
 
Google App Engine and Social Apps
Google App Engine and Social AppsGoogle App Engine and Social Apps
Google App Engine and Social Apps
 
Sassy Stylesheets with SCSS
Sassy Stylesheets with SCSSSassy Stylesheets with SCSS
Sassy Stylesheets with SCSS
 
Scalable Apps with Google App Engine
Scalable Apps with Google App EngineScalable Apps with Google App Engine
Scalable Apps with Google App Engine
 
GDD Brazil 2010 - What's new in Google App Engine and Google App Engine For B...
GDD Brazil 2010 - What's new in Google App Engine and Google App Engine For B...GDD Brazil 2010 - What's new in Google App Engine and Google App Engine For B...
GDD Brazil 2010 - What's new in Google App Engine and Google App Engine For B...
 
Developing Java Web Applications In Google App Engine
Developing Java Web Applications In Google App EngineDeveloping Java Web Applications In Google App Engine
Developing Java Web Applications In Google App Engine
 
Turbo theming: Introduction to Sass & Compass
Turbo theming: Introduction to Sass & CompassTurbo theming: Introduction to Sass & Compass
Turbo theming: Introduction to Sass & Compass
 
Stylesheet Wrangling with SCSS
Stylesheet Wrangling with SCSSStylesheet Wrangling with SCSS
Stylesheet Wrangling with SCSS
 
Theming and Sass
Theming and SassTheming and Sass
Theming and Sass
 
Front End Badassery with Sass
Front End Badassery with SassFront End Badassery with Sass
Front End Badassery with Sass
 
Frontend-Entwicklung mit SASS & Compass
Frontend-Entwicklung mit SASS & CompassFrontend-Entwicklung mit SASS & Compass
Frontend-Entwicklung mit SASS & Compass
 
Preprocessor presentation
Preprocessor presentationPreprocessor presentation
Preprocessor presentation
 
Performance front end language
Performance front end languagePerformance front end language
Performance front end language
 
老成的Sass&Compass
老成的Sass&Compass老成的Sass&Compass
老成的Sass&Compass
 
Getting Started with Sass & Compass
Getting Started with Sass & CompassGetting Started with Sass & Compass
Getting Started with Sass & Compass
 
anthesis Outlook Add-In
anthesis Outlook Add-Inanthesis Outlook Add-In
anthesis Outlook Add-In
 
10 Things You Need To Know About Digital CIOs
10 Things You Need To Know About Digital CIOs10 Things You Need To Know About Digital CIOs
10 Things You Need To Know About Digital CIOs
 

Ähnlich wie Save time by using SASS/SCSS

Wrangling the CSS Beast with Sass
Wrangling the CSS Beast  with SassWrangling the CSS Beast  with Sass
Wrangling the CSS Beast with SassRob Friesel
 
Sass and Compass - Getting Started
Sass and Compass - Getting StartedSass and Compass - Getting Started
Sass and Compass - Getting Startededgincvg
 
Work and play with SASS & Compass
Work and play with SASS & CompassWork and play with SASS & Compass
Work and play with SASS & CompassAndreas Dantz
 
Using Sass - Building on CSS
Using Sass - Building on CSSUsing Sass - Building on CSS
Using Sass - Building on CSSSayanee Basu
 
Sass - Making CSS fun again.
Sass - Making CSS fun again.Sass - Making CSS fun again.
Sass - Making CSS fun again.Gabriel Neutzling
 
CSS3 is Not Magic Pixie Dust
CSS3 is Not Magic Pixie DustCSS3 is Not Magic Pixie Dust
CSS3 is Not Magic Pixie DustKyle Adams
 
Doing More With Less
Doing More With LessDoing More With Less
Doing More With LessDavid Engel
 
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 CompassClaudina Sarahe
 
HTML&CSS 5 - Intermediate CSS (2/2)
HTML&CSS 5 - Intermediate CSS (2/2)HTML&CSS 5 - Intermediate CSS (2/2)
HTML&CSS 5 - Intermediate CSS (2/2)Dinis Correia
 
Big Design Conference: CSS3
Big Design Conference: CSS3 Big Design Conference: CSS3
Big Design Conference: CSS3 Wynn Netherland
 
Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)
Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)
Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)Adam Darowski
 
Sassive Aggressive: Using Sass to Make Your Life Easier (NSWG Version)
Sassive Aggressive: Using Sass to Make Your Life Easier (NSWG Version)Sassive Aggressive: Using Sass to Make Your Life Easier (NSWG Version)
Sassive Aggressive: Using Sass to Make Your Life Easier (NSWG Version)Adam Darowski
 

Ähnlich wie Save time by using SASS/SCSS (20)

Wrangling the CSS Beast with Sass
Wrangling the CSS Beast  with SassWrangling the CSS Beast  with Sass
Wrangling the CSS Beast with Sass
 
Sass and Compass - Getting Started
Sass and Compass - Getting StartedSass and Compass - Getting Started
Sass and Compass - Getting Started
 
FCIP SASS Talk
FCIP SASS TalkFCIP SASS Talk
FCIP SASS Talk
 
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
 
CSS Extenders
CSS ExtendersCSS Extenders
CSS Extenders
 
Using Sass - Building on CSS
Using Sass - Building on CSSUsing Sass - Building on CSS
Using Sass - Building on CSS
 
Sass, Compass
Sass, CompassSass, Compass
Sass, Compass
 
Sass - Making CSS fun again.
Sass - Making CSS fun again.Sass - Making CSS fun again.
Sass - Making CSS fun again.
 
CSS3 is Not Magic Pixie Dust
CSS3 is Not Magic Pixie DustCSS3 is Not Magic Pixie Dust
CSS3 is Not Magic Pixie Dust
 
Doing More With Less
Doing More With LessDoing More With Less
Doing More With Less
 
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
 
Css frameworks
Css frameworksCss frameworks
Css frameworks
 
Less css
Less cssLess css
Less css
 
HTML&CSS 5 - Intermediate CSS (2/2)
HTML&CSS 5 - Intermediate CSS (2/2)HTML&CSS 5 - Intermediate CSS (2/2)
HTML&CSS 5 - Intermediate CSS (2/2)
 
Less & Sass
Less & SassLess & Sass
Less & Sass
 
Big Design Conference: CSS3
Big Design Conference: CSS3 Big Design Conference: CSS3
Big Design Conference: CSS3
 
Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)
Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)
Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)
 
Sassive Aggressive: Using Sass to Make Your Life Easier (NSWG Version)
Sassive Aggressive: Using Sass to Make Your Life Easier (NSWG Version)Sassive Aggressive: Using Sass to Make Your Life Easier (NSWG Version)
Sassive Aggressive: Using Sass to Make Your Life Easier (NSWG Version)
 
Intro to SASS CSS
Intro to SASS CSSIntro to SASS CSS
Intro to SASS CSS
 

Kürzlich hochgeladen

Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
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 TerraformAndrey Devyatkin
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
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 businesspanagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 

Kürzlich hochgeladen (20)

Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
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
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
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
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 

Save time by using SASS/SCSS

  • 1. Save time by using SASS Structured CSS with SASS and sassify
  • 2. Berit Jensen ■ Frontend Developer, Certified TYPO3 Integrator at networkteam GmbH ■ TYPO3Phoenix Core Team Member ■ TYPO3Marketing Team Member
  • 3. CSS - The bad parts
  • 6. Mixed up colors and dimensions
  • 10. Compiler SCSS SCSS CSS SCSS will be compiled to CSS
  • 11. CSS SCSS You can simply copy existing CSS
  • 13. #header { #header { ... ... } ul.menu { #header ul.menu li a { ... ... li { } ... #header ul.menu li { a{ ... refactor ... } } li a { } ... li a { } ... #header ul.menu { } ... } CSS SCSS Nesting
  • 14. #header ul.menu li a { #header { color: #000; ul.menu { } li { #header ul.menu li a:hover { a{ color: #ccc; color: #000; } &:hover { color: #ccc; refactor } } } CSS SCSS Selector references
  • 15. $grey: #c7c7c7; $border-size: solid 1px; $border: $border-size $grey; #menu { #menu { ... ... border-left: solid 1px #c7c7c7; border-left: $border; border-top: solid 1px #c7c7c7; border-top: $border; border-right: solid 1px #c7c7c7; border-right: $border; } refactor } #rootline { #rootline { ... ... background-color: #c7c7c7; background-color: $grey; } } #content { #content { ... ... border-left: solid 1px #c7c7c7; border-left: $border; border-top: solid 1px #c7c7c7; border-top: $border; border-right: solid 1px #c7c7c7; border-right: $border; } CSS } SCSS Variables
  • 16. $total-width: 600px; $sidebar-width: 100px; $spacing: 20px; #content { #content { width: 500px; width: $total-width - $sidebar-width; padding: 40px; padding: $spacing * 2; } } #sidebar { refactor #sidebar { width: 100px; width: $sidebar-width; margin-left: 20px; margin-left: $spacing; } } CSS SCSS Calculations
  • 17. $color: #777777; #content { compile background-color: #444444; } #content { background-color: darken($color, 20%); h2 { } color: #f6f6f6; } h2 { color: lighten($color, 50%); } SCSS Functions (predefined)
  • 18. Functions http://sass-lang.com/docs/yardoc/Sass/Script/Functions.html adjust_hue(color, degrees) alpha(color) percentage(value) complement(color) blue(color) unit(number) darken(color, amount) green(color) unitless(number) desaturate(color, amount) hue(color) grayscale(color) red(color) quote(str) lighten(color, amount) opacity(color) unquote(str) mix(color1, color2, weight) lightness(color) opacify(color, amount) saturation(color) saturate(color, amount) transparentize(color, amount) abs(value) ceil(value) hsl(hue, saturation, lightness) floor(value) hsla(hue, saturation, lightness, round(value) alpha) rgb(red, green, blue) comparable(number1, number2) rgba(red, green, blue, alpha) type_of(obj) rgba(color, alpha)
  • 19. @mixin rounded-border { .rounded-box { border-radius: 4px; border-radius: 4px; -moz-border-radius: 4px; -moz-border-radius: 4px; -webkit-border-radius: 4px; -webkit-border-radius: 4px; } width: 250px; } .rounded-box { #navigation ul li { @include rounded-border; border-radius: 4px; width: 250px; -moz-border-radius: 4px; compile } -webkit-border-radius: 4px; } #navigation { ul { li { @include rounded-border; } } } SCSS CSS Mixins
  • 20. @mixin rounded-border($radius) { .rounded-box { border-radius: $radius; border-radius: 4px; -moz-border-radius: $radius; -moz-border-radius: 4px; -webkit-border-radius: $radius; -webkit-border-radius: 4px; } width: 250px; } .rounded-box { #navigation ul li { @include rounded-border(4px); border-radius: 2px; width: 250px; -moz-border-radius: 2px; compile } -webkit-border-radius: 2px; } #navigation { ul { li { @include rounded-border(2px); } } } SCSS CSS Mixins with arguments
  • 21. $color = #cc7700; #inhalt { compile background-color: #663c00; } @import "a.scss"; @import "b.scss"; h2 { SCSS color: #cc7700; } #inhalt { background-color: darken($color, 20%); } a.scss h2 { color: $color; } b.scss CSS Real Imports
  • 22. $type: business; p{ p{ compile color: green; } @if $type == ocean { color: blue; } @else if $type == matador { color: red; } @else if $type == business { color: green; } @else { color: black; } } SCSS CSS Control structures / if
  • 23. @for $i from 1 through 3 { h1 { h#{$i} { compile font-size: 0.8em; } font-size: 1em - (0.2 * $i); } h2 { } font-size: 0.6em; } h3 { font-size: 0.4em; } SCSS CSS Control structures / for
  • 24. /* /* * Multiline CSS Comment compile * Multiline CSS Comment */ */ body { color: black; } body { color: black; } // One-line, internal comment a { color: green } a{ color: green; } SCSS CSS Comments
  • 26. Installation ■ RubyInstaller (http://www.ruby-lang.org/de/downloads/) ■ Install the SASS Gem: sudo gem install sass --pre ■ or the PHP version PHamlP (http://code.google.com/p/phamlp)
  • 29. sass -g imports.scss > imports.css FireSass Firebug Extension
  • 31. sassify TYPO3 Extension based on PHamlP http://typo3.org/documentation/document-library/extension-manuals/sassify/1.0.1/view