20
Smart CSS theming with Smart CSS theming with Sass and Compass Sass and Compass Mihaela Jurković Mihaela Jurković

Smart CSS theming with Sass and Compass

  • Upload
    mihaela

  • View
    78

  • Download
    3

Embed Size (px)

Citation preview

Page 1: Smart CSS theming with Sass and Compass

Smart CSS theming with Smart CSS theming with Sass and CompassSass and Compass

Mihaela JurkovićMihaela Jurković

Page 2: Smart CSS theming with Sass and Compass

prkos.hr

Splitting code across files

● A variety of different strategies

● Pick one and stick to it!● SMACSS + SASS popular

(SMACSS – Scalable and Modular Architecture for CSSSMURF – Scalable, Modular, re**U**sable Rails Frontends)

Page 3: Smart CSS theming with Sass and Compass

prkos.hr

Nesting rules

● Never nest more than 3(?) levels deep

● Indent, don't nest! (Indenting relies on HTML structure too much, it's too specific and it isn't reusable)

!

Page 4: Smart CSS theming with Sass and Compass

prkos.hr

Variables

● Naming conventions – pick one and stick with it

Page 5: Smart CSS theming with Sass and Compass

prkos.hr

Variables

● Should you use descriptive or functional names?

Page 6: Smart CSS theming with Sass and Compass

prkos.hr

Variables

● Combine descriptive with functional variable names!

Page 7: Smart CSS theming with Sass and Compass

prkos.hr

Variables

● After adding a new color palette only the variables with functional names needs to be changed

Page 8: Smart CSS theming with Sass and Compass

prkos.hr

Mixins

● Mixins are sets of CSS declarations

● You can pass arguments to them (optional but super useful)

● For best results – develop a strategy

Page 9: Smart CSS theming with Sass and Compass

prkos.hr

Mixins – buttons

Page 10: Smart CSS theming with Sass and Compass

prkos.hr

Mixins – vignette

Page 11: Smart CSS theming with Sass and Compass

prkos.hr

Easy icons with Mixins and icon fonts

● Font Awesome (designed for Bootstrap)http://fortawesome.github.io/Font-Awesome/

● The Entypo Pictogram Suite – http://www.entypo.com/

● Typicons – http://typicons.com/

● Modern Pictograms – http://modernpictograms.com/

Page 12: Smart CSS theming with Sass and Compass

prkos.hr

Easy icons with Mixins and icon fonts – fontawesome

Page 13: Smart CSS theming with Sass and Compass

prkos.hr

Mixins vs. @extend vs. %placeholders

● Mixin declarations are repeated in compiled CSS when applied to different selectors

● @extend groups selectors so declarations aren't repeated

● %placeholder syntax (new in Sass 3.2) – “Silent classes”

Page 14: Smart CSS theming with Sass and Compass

prkos.hr

Many other Sass features

● Functions (adjusting colors, numbers, lists...)● Control directives (@if, @for, @while...)● Define your own functions● ...

Page 15: Smart CSS theming with Sass and Compass

prkos.hr

Compass – Sass library

● Compass Core Framework | Compass Documentation http://compass-style.org/reference/compass/

● Sass Resources and Referencehttp://sass-lang.com/

Page 16: Smart CSS theming with Sass and Compass

prkos.hr

Grids based on Sass

● No extraneous markup <div class="grid_2 mq1_grid_6 mq2_grid_8 mq2_push_3 mq3_grid_7 mq3_pull_4"></div>

● Easy responsiveness ● Saves a lot of time spent on CSS layouts ● Zen grids, Susy grid...

Page 17: Smart CSS theming with Sass and Compass

prkos.hr

Crazy Sass text shadows

● Sassy Mother Effing Text Shadowhttp://sassymothereffingtextshadow.com/

Page 18: Smart CSS theming with Sass and Compass

prkos.hr

Crazy Sass text shadows

Page 19: Smart CSS theming with Sass and Compass

prkos.hr

Conclusion

● Sass and Compass is the future of CSS● Learn CSS first! ● If you're not using Mixins you're not reaping

the benefits

Page 20: Smart CSS theming with Sass and Compass

prkos.hr

Thank you!

Mihaela Jurković

[email protected]

Skype: mihaela-prkos