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

Metaprogramming Sass

Metaprogramming Sass

With the release of Sass v3.3, we can now author CSS using new levels of sophisticated programming techniques. Join me in an academic dive into some new ways to meta program using pure Sass script. We will explore how existing frameworks solve hard problems and expose critical next level building blocks for your new projects.

This talk will start from the ground up, so fear not! Even if you are new to Sass or programming in general, we will make sure to explain it all as we go.

Ken Collins

April 07, 2014
Tweet

More Decks by Ken Collins

Other Decks in Technology

Transcript

  1. 2

  2. 6

  3. Other Great Sass Features • Nesting • Imports & Partials

    • Operators • String Interpolation 15
  4. Other Great Sass Features • Nesting • Imports & Partials

    • Operators • String Interpolation • Control Directives 15
  5. Other Great Sass Features • Nesting • Imports & Partials

    • Operators • String Interpolation • Control Directives • Parent Selectors With “&” 15
  6. Other Great Sass Features • Nesting • Imports & Partials

    • Operators • String Interpolation • Control Directives • Parent Selectors With “&” • Data Structures (lists, maps, etc.) 15
  7. Other Great Sass Features • Nesting • Imports & Partials

    • Operators • String Interpolation • Control Directives • Parent Selectors With “&” • Data Structures (lists, maps, etc.) • Content Blocks (think yield w/ruby) 15
  8. Metaprogramming Tools • @each –Process data into executable code. •

    %placeholder-selectors –Presentation & semantic framework. 22
  9. Metaprogramming Tools • @each –Process data into executable code. •

    %placeholder-selectors –Presentation & semantic framework. • @function –Our own implementation helpers. 22
  10. Metaprogramming Tools • @each –Process data into executable code. •

    %placeholder-selectors –Presentation & semantic framework. • @function –Our own implementation helpers. • @mixin –When absolutely needed. 22
  11. What Just Happened? • We turned a Sass map into

    executable framework code using placeholder selectors. 44
  12. What Just Happened? • We turned a Sass map into

    executable framework code using placeholder selectors. • We then extended Sass with Sass and gave it new string behaviors. 44
  13. What Just Happened? • We turned a Sass map into

    executable framework code using placeholder selectors. • We then extended Sass with Sass and gave it new string behaviors. • Using these tools, we wrote a Sass mixin to use all that Sass! 44
  14. What Just Happened? • We turned a Sass map into

    executable framework code using placeholder selectors. • We then extended Sass with Sass and gave it new string behaviors. • Using these tools, we wrote a Sass mixin to use all that Sass! 44
  15. What Just Happened? • We turned a Sass map into

    executable framework code using placeholder selectors. • We then extended Sass with Sass and gave it new string behaviors. • Using these tools, we wrote a Sass mixin to use all that Sass! 44
  16. Related Reading • Advanced String Handling For Sass
 https://github.com/Team-Sass/Sassy-Strings •

    Advanced Sass List Manipulation
 https://github.com/Team-Sass/SassyLists 45
  17. Related Reading • Advanced String Handling For Sass
 https://github.com/Team-Sass/Sassy-Strings •

    Advanced Sass List Manipulation
 https://github.com/Team-Sass/SassyLists • OOCSS + Sass = The best way to CSS
 http://ianstormtaylor.com/oocss-plus-sass-is-the-best-way-to-css/ 45
  18. Related Reading • Advanced String Handling For Sass
 https://github.com/Team-Sass/Sassy-Strings •

    Advanced Sass List Manipulation
 https://github.com/Team-Sass/SassyLists • OOCSS + Sass = The best way to CSS
 http://ianstormtaylor.com/oocss-plus-sass-is-the-best-way-to-css/ • Defending Presentational Class Names
 http://tympanus.net/codrops/2013/01/22/defending-presentational- class-names/ 45