SlideShare une entreprise Scribd logo
1  sur  34
Télécharger pour lire hors ligne
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?

Contenu connexe

En vedette

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
 

En vedette (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
 

Similaire à 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
 

Similaire à 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
 

Dernier

ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
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
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
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
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
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
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 

Dernier (20)

ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
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...
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
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...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
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
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 

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