SlideShare una empresa de Scribd logo
1 de 32
WordPress with SASSLESS


© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Who am I
•     Ran Bar-Zik  @barzik
•     Software Developer at HP Software R&D
•     Working at HP Live Network project.
•     My professional site: internet-israel.com




    © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Variables in SASS
$some-color: #fefecc;

p {
                    color: $some-color;
}

a {
                    border-bottom: $some-color;
}

strong {
                    background-color: $some-color;
}

.someClass {
           border: $some-color solid 1px;
}

    © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Mixins in SASS
@mixin RoundBorders ($radius: 5px) {
  border-radius: $radius;
}

p {
@include RoundBorders ();
}

a {
@include RoundBorders ();
}

strong {
@include RoundBorders ();
}

.someClass {
@include RoundBorders ();
}
  © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Nesting
a {
text-deocration: none;
   &:hover {
       text-decoration:underline;
   }
}




 © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
CSS code
  h1 {
    font-family: "Arial Black";
    font-weight: normal;
    font-size: 30px;
    color: #fefecc;
    letter-spacing: -1px;
  }
  h1:hover {
    text-decoration: underline;
  }

  h2 {
    font-family: "Arial Black";
    font-weight: normal;
    font-size: 20px;
    color: #fefecc;
    letter-spacing: -1px;
  }
  h2:hover {
    text-decoration: underline;
  }

  h3 {
    font-family: "Arial Black";
    font-weight: normal;
    font-size: 15px;
    color: #fefecc;
    letter-spacing: -1px;
  }
  h3:hover {
    text-decoration: underline;
  }}
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
SASS code
  @mixin headerMaker ($size: 10px) {
               $header-color: #fefecc;
      font-family: "Arial Black";
               font-weight: normal;
               font-size: $size;
               color: $header-color;
               letter-spacing: -1px;
               &:hover {
                             text-decoration: underline;
               }
  }

  h1 {
                        @include headerMaker(30px);
  }

  h2 {
                        @include headerMaker(20px);
  }

  h3 {
                        @include headerMaker(15px);
  }
                                                                                                                                   }
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Why using SASSLESS ?
• Developers that create new themes
• Developers that maintain long-term applications
  and sites.
• Developers that duplicates patterns & styles
  across the blog
• Eventually it is the future – like jQuery is the
  standard for JavaScript developing, LESSSASS will
  be the standard for CSS developing.
 © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
How is SASSLESS is working



                                                                                  CSS preprocessor
                     SCSS files                                                                                                    CSS file




© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
SASS preprocessors
• On Linux everything is easy:
  SASS: sass –watch input_dir:output_dir
• On Windows:
  Scout



 © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
SASS: Variables
• Defined by $.
Example:
$some-var: #000000;
.someClass {
     color: $some-var;
}
 © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
SASS: Variables
Will be compiled to:
.someClass {
      color: #000000;
}


 © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Variables can be anything!
•     Colors
•     Numbers
•     Text
•     List
•     Boolean

    © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Variables can be changed!
$some-size: 15px;

h1 {
                    font-size: $some-size*2;
}
h6 {
                    font-size: $some-size/2
}
    © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
SASS functions
$some-color: #fefefe;

a {
                 color: $some-color;
}
a:hover {
    color: lighten($some-color, 20%);
}
 © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
It will be compiled to:
a {
  color: #fefe45;
}

a:hover {
  color: #ffffaa;
}
 © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
SASS nesting
.someClass a {
  color: #fefe45;
}
.someClass p {
  color: #000000;
}




 © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
SASS nesting
.someClass {
    a {
        color: #fefe45;
    }
    p {
      color: #000000;
    }
}


 © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
SASS Nesting and reference
  SCSS Source
a {
                    color: #fefe45;
                    &:hover {
                          color: #fff;
                    }
}




    © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
SASS Nesting and reference
  CSS output
a {
  color: #fefe45;
}
a:hover {
  color: #fff;
}




 © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
SASS mixins
• The SASS “functions”
• The main way to divide the CSS code to
  small, reusable parts.
• Clusters of mixins can be used as a base layer to
  every projects.
• In HP Software HP Live network we developed HP
  Experience on SASS and LESS that contains basic
  mixins for every basic CSS elements.
 © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
SASS mixin - example
@mixin my-great-mixin() {
         color: #000;
         font-size: 14px;
}
p {
         @include my-great-mixin();
}
a {
         @include my-great-mixin();
}




  © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
SASS mixin - output
p {
  color: #000;
  font-size: 14px;
}

a {
  color: #000;
  font-size: 14px;
}




  © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
SASS BIDI




© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
How to use SASSLESS on
 existing WordPress project?
• Copy style.css & rtl.css to style.scss & rtl.scss.
• Run scoutother preprocessors.
• That’s it!




 © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
SASSLESS on WordPress –
bones base theme




© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Directory tree
• Create SCSSLESS directory and CSS directory




 © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
SCSS directory
• Put all the SCSS files in the SCSS directory
• Make sure that there is a style.scss file.




 © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
The compiled CSS file will be at
 the CSS directory
• We need to make sure that WordPress will
  point the theme style to
  my_theme/css/style.css and not to
  my_theme/style.css
• We do it with add_action right after “after
  setup theme” hook.
 © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Using after setup theme hook
•
    to add custom CSS file
      At functions.php:

add_action('after_setup_theme','my_theme_setup_function');

function my_theme_setup_function() {
    add_action('wp_enqueue_scripts', 'my_theme_scripts_and_styles');
}

function my_theme_scripts_and_styles() {
        // register main stylesheet
  wp_register_style( 'bones-stylesheet', get_stylesheet_directory_uri() .
'/my_theme/css/style.css', array(), '', 'all' );
}



    © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
At the style.scss
• Use import & media queries to import
  _files.scss according to device features.




 © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Thank you




© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.

Más contenido relacionado

La actualidad más candente

La actualidad más candente (18)

Grok Drupal (7) Theming
Grok Drupal (7) ThemingGrok Drupal (7) Theming
Grok Drupal (7) Theming
 
Web Development
Web DevelopmentWeb Development
Web Development
 
Using Core Themes in Drupal 8
Using Core Themes in Drupal 8Using Core Themes in Drupal 8
Using Core Themes in Drupal 8
 
WordPress Theme Development
WordPress Theme DevelopmentWordPress Theme Development
WordPress Theme Development
 
Prototyping interactions
Prototyping interactionsPrototyping interactions
Prototyping interactions
 
Php
PhpPhp
Php
 
新 · 交互
新 · 交互新 · 交互
新 · 交互
 
Creating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme
Creating Responsive Drupal Sites with Zen Grids and the Zen 5 ThemeCreating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme
Creating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme
 
The Future Of CSS
The Future Of CSSThe Future Of CSS
The Future Of CSS
 
Grown-up javascript with AngularJS
Grown-up javascript with AngularJSGrown-up javascript with AngularJS
Grown-up javascript with AngularJS
 
Drupal - Introduction to Drupal and Web Content Management
Drupal - Introduction to Drupal and Web Content ManagementDrupal - Introduction to Drupal and Web Content Management
Drupal - Introduction to Drupal and Web Content Management
 
Drupal 7 Theme System
Drupal 7 Theme SystemDrupal 7 Theme System
Drupal 7 Theme System
 
SMACSS Workshop
SMACSS WorkshopSMACSS Workshop
SMACSS Workshop
 
File formats
File formatsFile formats
File formats
 
Css Founder.com | Cssfounder Net
Css Founder.com | Cssfounder NetCss Founder.com | Cssfounder Net
Css Founder.com | Cssfounder Net
 
wordpress
wordpresswordpress
wordpress
 
The web context
The web contextThe web context
The web context
 
Php reports sumit
Php reports sumitPhp reports sumit
Php reports sumit
 

Similar a Using SASS in the WordPress environment - Ran Bar Zik

Sass and Compass - Getting Started
Sass and Compass - Getting StartedSass and Compass - Getting Started
Sass and Compass - Getting Started
edgincvg
 
Introduction to CSS Preprocessors
Introduction to CSS PreprocessorsIntroduction to CSS Preprocessors
Introduction to CSS Preprocessors
Blake Newman
 
CSS preprocessor: why and how
CSS preprocessor: why and howCSS preprocessor: why and how
CSS preprocessor: why and how
mirahman
 
LESS is More
LESS is MoreLESS is More
LESS is More
jsmith92
 

Similar a Using SASS in the WordPress environment - Ran Bar Zik (20)

CSS3
CSS3CSS3
CSS3
 
Brian Hoke: WordCamp Toronto 2014 Presentation "Sass & WordPress"
Brian Hoke: WordCamp Toronto 2014 Presentation "Sass & WordPress"Brian Hoke: WordCamp Toronto 2014 Presentation "Sass & WordPress"
Brian Hoke: WordCamp Toronto 2014 Presentation "Sass & WordPress"
 
Less css
Less cssLess css
Less css
 
An Introduction to CSS Preprocessors (SASS & LESS)
An Introduction to CSS Preprocessors (SASS & LESS)An Introduction to CSS Preprocessors (SASS & LESS)
An Introduction to CSS Preprocessors (SASS & LESS)
 
CSS Extenders
CSS ExtendersCSS Extenders
CSS Extenders
 
Why less?
Why less?Why less?
Why less?
 
CSS 開發加速指南-Sass & Compass
CSS 開發加速指南-Sass & CompassCSS 開發加速指南-Sass & Compass
CSS 開發加速指南-Sass & Compass
 
Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)
 
LESS CSS
LESS CSSLESS CSS
LESS CSS
 
Understanding sass
Understanding sassUnderstanding sass
Understanding sass
 
Sass and Compass - Getting Started
Sass and Compass - Getting StartedSass and Compass - Getting Started
Sass and Compass - Getting Started
 
Pacific Northwest Drupal Summit: Basic & SASS
Pacific Northwest Drupal Summit: Basic & SASSPacific Northwest Drupal Summit: Basic & SASS
Pacific Northwest Drupal Summit: Basic & SASS
 
SASS, Compass, Gulp, Greensock
SASS, Compass, Gulp, GreensockSASS, Compass, Gulp, Greensock
SASS, Compass, Gulp, Greensock
 
Introduction to CSS Preprocessors
Introduction to CSS PreprocessorsIntroduction to CSS Preprocessors
Introduction to CSS Preprocessors
 
SASS Preprocessor
SASS PreprocessorSASS Preprocessor
SASS Preprocessor
 
Team styles
Team stylesTeam styles
Team styles
 
AAVN_Presentation_SASS.pptx
AAVN_Presentation_SASS.pptxAAVN_Presentation_SASS.pptx
AAVN_Presentation_SASS.pptx
 
Css preprocessor-140606115334-phpapp01
Css preprocessor-140606115334-phpapp01Css preprocessor-140606115334-phpapp01
Css preprocessor-140606115334-phpapp01
 
CSS preprocessor: why and how
CSS preprocessor: why and howCSS preprocessor: why and how
CSS preprocessor: why and how
 
LESS is More
LESS is MoreLESS is More
LESS is More
 

Más de Miriam Schwab

WordPress site planning, WordCamp Jerusalem 2013
WordPress site planning, WordCamp Jerusalem 2013WordPress site planning, WordCamp Jerusalem 2013
WordPress site planning, WordCamp Jerusalem 2013
Miriam Schwab
 
The Power of Your Story - Kimanzi Constable
The Power of Your Story - Kimanzi ConstableThe Power of Your Story - Kimanzi Constable
The Power of Your Story - Kimanzi Constable
Miriam Schwab
 
מצגת יעל הרמן מוורדקמפ ירושלים 2013
מצגת יעל הרמן מוורדקמפ ירושלים 2013מצגת יעל הרמן מוורדקמפ ירושלים 2013
מצגת יעל הרמן מוורדקמפ ירושלים 2013
Miriam Schwab
 
The Business of WordPress - WordCamp Jerusalem 2013
The Business of WordPress - WordCamp Jerusalem 2013The Business of WordPress - WordCamp Jerusalem 2013
The Business of WordPress - WordCamp Jerusalem 2013
Miriam Schwab
 
היכרות עם וורדפרס ועוד חן כהן
היכרות עם וורדפרס ועוד   חן כהןהיכרות עם וורדפרס ועוד   חן כהן
היכרות עם וורדפרס ועוד חן כהן
Miriam Schwab
 
מ-antispambot ועד zeroise – עשר פונקציות וורדפרס שאתם כנראה לא מכירים
מ-antispambot ועד zeroise – עשר פונקציות וורדפרס שאתם כנראה לא מכיריםמ-antispambot ועד zeroise – עשר פונקציות וורדפרס שאתם כנראה לא מכירים
מ-antispambot ועד zeroise – עשר פונקציות וורדפרס שאתם כנראה לא מכירים
Miriam Schwab
 
Google Analytics for PPC: SMX Israel 2013
Google Analytics for PPC: SMX Israel 2013Google Analytics for PPC: SMX Israel 2013
Google Analytics for PPC: SMX Israel 2013
Miriam Schwab
 

Más de Miriam Schwab (20)

Making your content fly with onsite SEO
Making your content fly with onsite SEOMaking your content fly with onsite SEO
Making your content fly with onsite SEO
 
Content Security Policies: A whole new way of securing your website that no o...
Content Security Policies: A whole new way of securing your website that no o...Content Security Policies: A whole new way of securing your website that no o...
Content Security Policies: A whole new way of securing your website that no o...
 
Digitizing your business
Digitizing your businessDigitizing your business
Digitizing your business
 
Managing multitudes of media
Managing multitudes of mediaManaging multitudes of media
Managing multitudes of media
 
Mobile SEO at SMX Israel 2014
Mobile SEO at SMX Israel 2014Mobile SEO at SMX Israel 2014
Mobile SEO at SMX Israel 2014
 
WordPress for Startups
WordPress for StartupsWordPress for Startups
WordPress for Startups
 
How to add semantic data to your WP site in 20 minutes or less! WordSesh 2013
How to add semantic data to your WP site in 20 minutes or less! WordSesh 2013How to add semantic data to your WP site in 20 minutes or less! WordSesh 2013
How to add semantic data to your WP site in 20 minutes or less! WordSesh 2013
 
Getting an online marketing job in Jerusalem - is that even possible?
Getting an online marketing job in Jerusalem - is that even possible?Getting an online marketing job in Jerusalem - is that even possible?
Getting an online marketing job in Jerusalem - is that even possible?
 
Responsive Design for WordPress
Responsive Design for WordPressResponsive Design for WordPress
Responsive Design for WordPress
 
WordPress site planning, WordCamp Jerusalem 2013
WordPress site planning, WordCamp Jerusalem 2013WordPress site planning, WordCamp Jerusalem 2013
WordPress site planning, WordCamp Jerusalem 2013
 
The Power of Your Story - Kimanzi Constable
The Power of Your Story - Kimanzi ConstableThe Power of Your Story - Kimanzi Constable
The Power of Your Story - Kimanzi Constable
 
מצגת יעל הרמן מוורדקמפ ירושלים 2013
מצגת יעל הרמן מוורדקמפ ירושלים 2013מצגת יעל הרמן מוורדקמפ ירושלים 2013
מצגת יעל הרמן מוורדקמפ ירושלים 2013
 
The Business of WordPress - WordCamp Jerusalem 2013
The Business of WordPress - WordCamp Jerusalem 2013The Business of WordPress - WordCamp Jerusalem 2013
The Business of WordPress - WordCamp Jerusalem 2013
 
היכרות עם וורדפרס ועוד חן כהן
היכרות עם וורדפרס ועוד   חן כהןהיכרות עם וורדפרס ועוד   חן כהן
היכרות עם וורדפרס ועוד חן כהן
 
מ-antispambot ועד zeroise – עשר פונקציות וורדפרס שאתם כנראה לא מכירים
מ-antispambot ועד zeroise – עשר פונקציות וורדפרס שאתם כנראה לא מכיריםמ-antispambot ועד zeroise – עשר פונקציות וורדפרס שאתם כנראה לא מכירים
מ-antispambot ועד zeroise – עשר פונקציות וורדפרס שאתם כנראה לא מכירים
 
Small but mighty - Google+, Instagram, Pinterest
Small but mighty - Google+, Instagram, PinterestSmall but mighty - Google+, Instagram, Pinterest
Small but mighty - Google+, Instagram, Pinterest
 
Measuring Twitter: SMX Israel 2013
Measuring Twitter: SMX Israel 2013Measuring Twitter: SMX Israel 2013
Measuring Twitter: SMX Israel 2013
 
Google Analytics for PPC: SMX Israel 2013
Google Analytics for PPC: SMX Israel 2013Google Analytics for PPC: SMX Israel 2013
Google Analytics for PPC: SMX Israel 2013
 
Introduction to the semantic web: SMX Israel 2013
Introduction to the semantic web: SMX Israel 2013Introduction to the semantic web: SMX Israel 2013
Introduction to the semantic web: SMX Israel 2013
 
Blogging with WordPress.com for beginners, part 1/3, by Deena Levenstein IN H...
Blogging with WordPress.com for beginners, part 1/3, by Deena Levenstein IN H...Blogging with WordPress.com for beginners, part 1/3, by Deena Levenstein IN H...
Blogging with WordPress.com for beginners, part 1/3, by Deena Levenstein IN H...
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (20)

Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
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
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
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
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
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
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
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
 
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
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 

Using SASS in the WordPress environment - Ran Bar Zik

  • 1. WordPress with SASSLESS © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
  • 2. Who am I • Ran Bar-Zik @barzik • Software Developer at HP Software R&D • Working at HP Live Network project. • My professional site: internet-israel.com © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
  • 3. Variables in SASS $some-color: #fefecc; p { color: $some-color; } a { border-bottom: $some-color; } strong { background-color: $some-color; } .someClass { border: $some-color solid 1px; } © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
  • 4. Mixins in SASS @mixin RoundBorders ($radius: 5px) { border-radius: $radius; } p { @include RoundBorders (); } a { @include RoundBorders (); } strong { @include RoundBorders (); } .someClass { @include RoundBorders (); } © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
  • 5. Nesting a { text-deocration: none; &:hover { text-decoration:underline; } } © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
  • 6. CSS code h1 { font-family: "Arial Black"; font-weight: normal; font-size: 30px; color: #fefecc; letter-spacing: -1px; } h1:hover { text-decoration: underline; } h2 { font-family: "Arial Black"; font-weight: normal; font-size: 20px; color: #fefecc; letter-spacing: -1px; } h2:hover { text-decoration: underline; } h3 { font-family: "Arial Black"; font-weight: normal; font-size: 15px; color: #fefecc; letter-spacing: -1px; } h3:hover { text-decoration: underline; }} © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
  • 7. SASS code @mixin headerMaker ($size: 10px) { $header-color: #fefecc; font-family: "Arial Black"; font-weight: normal; font-size: $size; color: $header-color; letter-spacing: -1px; &:hover { text-decoration: underline; } } h1 { @include headerMaker(30px); } h2 { @include headerMaker(20px); } h3 { @include headerMaker(15px); } } © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
  • 8. Why using SASSLESS ? • Developers that create new themes • Developers that maintain long-term applications and sites. • Developers that duplicates patterns & styles across the blog • Eventually it is the future – like jQuery is the standard for JavaScript developing, LESSSASS will be the standard for CSS developing. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
  • 9. How is SASSLESS is working CSS preprocessor SCSS files CSS file © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
  • 10. SASS preprocessors • On Linux everything is easy: SASS: sass –watch input_dir:output_dir • On Windows: Scout © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
  • 11. SASS: Variables • Defined by $. Example: $some-var: #000000; .someClass { color: $some-var; } © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
  • 12. SASS: Variables Will be compiled to: .someClass { color: #000000; } © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
  • 13. Variables can be anything! • Colors • Numbers • Text • List • Boolean © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
  • 14. Variables can be changed! $some-size: 15px; h1 { font-size: $some-size*2; } h6 { font-size: $some-size/2 } © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
  • 15. SASS functions $some-color: #fefefe; a { color: $some-color; } a:hover { color: lighten($some-color, 20%); } © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
  • 16. It will be compiled to: a { color: #fefe45; } a:hover { color: #ffffaa; } © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
  • 17. SASS nesting .someClass a { color: #fefe45; } .someClass p { color: #000000; } © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
  • 18. SASS nesting .someClass { a { color: #fefe45; } p { color: #000000; } } © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
  • 19. SASS Nesting and reference SCSS Source a { color: #fefe45; &:hover { color: #fff; } } © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
  • 20. SASS Nesting and reference CSS output a { color: #fefe45; } a:hover { color: #fff; } © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
  • 21. SASS mixins • The SASS “functions” • The main way to divide the CSS code to small, reusable parts. • Clusters of mixins can be used as a base layer to every projects. • In HP Software HP Live network we developed HP Experience on SASS and LESS that contains basic mixins for every basic CSS elements. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
  • 22. SASS mixin - example @mixin my-great-mixin() { color: #000; font-size: 14px; } p { @include my-great-mixin(); } a { @include my-great-mixin(); } © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
  • 23. SASS mixin - output p { color: #000; font-size: 14px; } a { color: #000; font-size: 14px; } © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
  • 24. SASS BIDI © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
  • 25. How to use SASSLESS on existing WordPress project? • Copy style.css & rtl.css to style.scss & rtl.scss. • Run scoutother preprocessors. • That’s it! © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
  • 26. SASSLESS on WordPress – bones base theme © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
  • 27. Directory tree • Create SCSSLESS directory and CSS directory © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
  • 28. SCSS directory • Put all the SCSS files in the SCSS directory • Make sure that there is a style.scss file. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
  • 29. The compiled CSS file will be at the CSS directory • We need to make sure that WordPress will point the theme style to my_theme/css/style.css and not to my_theme/style.css • We do it with add_action right after “after setup theme” hook. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
  • 30. Using after setup theme hook • to add custom CSS file At functions.php: add_action('after_setup_theme','my_theme_setup_function'); function my_theme_setup_function() { add_action('wp_enqueue_scripts', 'my_theme_scripts_and_styles'); } function my_theme_scripts_and_styles() { // register main stylesheet wp_register_style( 'bones-stylesheet', get_stylesheet_directory_uri() . '/my_theme/css/style.css', array(), '', 'all' ); } © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
  • 31. At the style.scss • Use import & media queries to import _files.scss according to device features. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
  • 32. Thank you © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.