Upgrade to Pro — share decks privately, control downloads, hide ads and more …

WordCamp Milwaukee 2013: Getting SASSy - Fun with CSS Preproccessors

WordCamp Milwaukee 2013: Getting SASSy - Fun with CSS Preproccessors

Write your CSS faster and more efficiently. CSS pre-processors like SASS and LESS let you write DRY CSS that can be modularly used to create themes and sites quite a bit faster.
Starting from a beginner’s perspective, this talk will allow anyone (designers & developers) to get started with SASS or LESS for their WordPress themeing.

Brad Parbs

June 08, 2013
Tweet

More Decks by Brad Parbs

Other Decks in Technology

Transcript

  1. #wcmke
    Let’s get SASSy

    View full-size slide

  2. #wcmke
    #wcmke
    I’m Brad Parbs.
    Created WOLF, hook_s & wpWizard
    Core Contributor in 3.5 & 3.6
    Run Snow Day Group, (snowday.io)
    ♥ WordPress, Startups, and Code
    Plugin and Theme author/developer
    @BradParbs
    brad.parbs.me

    View full-size slide

  3. #wcmke
    What is SASS?
    “Sass is a meta-language on top of CSS ... with
    more power than flat CSS allows. Sass both
    provides a simpler, more elegant syntax for CSS
    and implements various features that are useful for
    creating manageable stylesheets.”
    sass-lang.org

    View full-size slide

  4. #wcmke
    What is SASS?
    Write less, do more.

    View full-size slide

  5. #wcmke
    What is SASS?
    SASS is awesome.

    View full-size slide

  6. #wcmke
    Why SASS over LESS?
    Compass - “drop-in” bits of SASS
    @extend() - allows for cleaner HTML
    Easily Embedding Media Queries
    #wcmke

    View full-size slide

  7. #wcmke
    Installation
    Prepros
    #wcmke

    View full-size slide

  8. #wcmke
    Now we write some SASS...
    #wcmke

    View full-size slide

  9. #wcmke
    And it becomes CSS!
    #wcmke

    View full-size slide

  10. #wcmke
    Any Questions?

    View full-size slide

  11. #wcmke
    Let’s get SASSy

    View full-size slide

  12. #wcmke
    Two Flavors
    .scss .sass
    #wcmke

    View full-size slide

  13. #wcmke
    Two Flavors
    .scss .sass
    More similar to CSS
    Easier to jump into from CSS
    What Snow Day Group uses
    Less keystrokes
    Cleaner files
    #wcmke

    View full-size slide

  14. #wcmke
    Partials / File Structure
    http://b.parbs.me/PP2n
    http://b.parbs.me/POcZ
    #wcmke

    View full-size slide

  15. #wcmke
    Nesting
    #wcmke

    View full-size slide

  16. #wcmke
    Nesting
    #wcmke
    Nesting

    View full-size slide

  17. #wcmke
    Parent Selector Reference
    #wcmke

    View full-size slide

  18. #wcmke
    Parent Selector Reference
    #wcmke

    View full-size slide

  19. #wcmke
    Selector Bubble Up
    Perfect for using Media Queries to build responsively.
    #wcmke

    View full-size slide

  20. #wcmke
    Variables
    #wcmke

    View full-size slide

  21. #wcmke
    @extend()
    #wcmke
    #wcmke

    View full-size slide

  22. #wcmke
    @extend()
    #wcmke

    View full-size slide

  23. #wcmke
    Silent @extend
    #wcmke

    View full-size slide

  24. #wcmke
    Mixins

    View full-size slide

  25. #wcmke
    Mixins

    View full-size slide

  26. #wcmke
    Mixins with Arguments
    w/

    View full-size slide

  27. #wcmke
    Mixins with Arguments
    w/

    View full-size slide

  28. #wcmke
    Mixins with Default Arguments

    View full-size slide

  29. #wcmke
    Mixins

    View full-size slide

  30. #wcmke
    http://bourbon.io/

    View full-size slide

  31. #wcmke
    Mixins
    Appearance
    Background Clip
    Background Origin
    Background Size
    Border Radius
    Box
    Box Shadow
    Box Sizing
    CSS Regions
    CSS3 Pie
    Columns
    Filter
    Font Face
    http://compass-style.org

    View full-size slide

  32. #wcmke
    Operations

    View full-size slide

  33. #wcmke
    Operations within functions

    View full-size slide

  34. #wcmke
    Color Functions

    View full-size slide

  35. #wcmke
    Color Functions
    examples from: http://b.parbs.me/PSRH
    $base-color: #AD141E;
    darken( $base-color, 10% );
    lighten( $base-color, 10% );
    saturate( $base-color, 20% );
    desaturate( $base-color, 20% );
    adjust-hue( $base-color, 20% );

    View full-size slide

  36. #wcmke
    Color Functions

    View full-size slide

  37. #wcmke
    Color Functions

    View full-size slide

  38. #wcmke
    Color Functions

    View full-size slide

  39. #wcmke
    Color Operations
    http://sassme.arc90.com/

    View full-size slide

  40. #wcmke
    Operations with Directive

    View full-size slide

  41. #wcmke
    #wcmke
    Operations - Range of Numbers

    View full-size slide

  42. #wcmke
    Operations - Range of Numbers with Silent placeholders
    #wcmke

    View full-size slide

  43. #wcmke
    #wcmke
    Operations - List of Values

    View full-size slide

  44. #wcmke
    #wcmke
    config.rb

    View full-size slide

  45. #wcmke
    #wcmke
    config.rb

    View full-size slide

  46. #wcmke
    #wcmke
    Let’s install Twitter Bootstrap
    Without SASS:
    1.Download zip file.
    2. Copy+Paste into stylesheet
    or: @import another CSS file
    or: another CSS file
    3.Redo all of this when there’s an
    update.
    4.Ugh this sucks, I’ll just use
    BootstrapWP.

    View full-size slide

  47. #wcmke
    #wcmke
    Let’s install Twitter Bootstrap
    With SASS:
    1.$ gem install compass-bootstrap
    (only have to ever do this once)
    2. Add require “compass-
    bootstrap” to config.rb.

    View full-size slide

  48. #wcmke
    #wcmke
    Let’s install Twitter Bootstrap
    https://github.com/hecbuma/compass-bootstrap

    View full-size slide

  49. #wcmke
    #wcmke
    config.rb

    View full-size slide

  50. #wcmke
    #wcmke
    config.rb

    View full-size slide

  51. #wcmke
    #wcmke
    Processing Modes
    :nested
    :expanded
    :compact
    :compressed

    View full-size slide

  52. #wcmke
    #wcmke
    config.rb

    View full-size slide

  53. #wcmke
    #wcmke
    Building a WP Theme
    • We want only one stylesheet
    • Our SASS folder should live
    independently
    • config.rb in the root, so we can use
    Codekit to optimize images & JS
    https://github.com/bradp/Wolf

    View full-size slide

  54. #wcmke
    #wcmke
    Building a WP Theme

    View full-size slide

  55. #wcmke
    #wcmke
    Tools
    http://sassmeister.com/ http://codepen.io/
    http://thesassway.com/

    View full-size slide

  56. #wcmke
    #wcmke
    Resources
    http://alistapart.com/article/getting-started-with-sass
    http://css-tricks.com/redesigning-with-sass/
    https://speakerdeck.com/anotheruiguy/clean-out-your-sass-junk-drawer
    https://speakerdeck.com/irishstu/an-introduction-to-sassy-css
    http://sass-lang.com/

    View full-size slide

  57. #wcmke
    #wcmke
    I’m Brad Parbs.
    @BradParbs
    brad.parbs.me
    http://b.parbs.me/PSye
    Slides:

    View full-size slide