18
CSS to SCSS Making the Switch

Css to-scss

Embed Size (px)

Citation preview

Page 1: Css to-scss

CSS to SCSSMaking the Switch

Page 2: Css to-scss

Rob WalkerCTO of Papertrail.io

Made the switch in September 2013, and have

never looked back

[email protected] @_rob_walker_

Page 3: Css to-scss

Coming up• Why you should use SCSS

• Working with SCSS

• Making the switch

• Next steps

• Questions

Page 4: Css to-scss

Resources

• Examples from this talk at - https://github.com/papertrailrob/frontendne-scss

• http://sass-lang.com

Page 5: Css to-scss

Why should you use SCSS

• Easy to learn, and you can start today

• Makes CSS more powerful

• Will make your life easier

Page 6: Css to-scss

Working with SCSS

• Nesting

• Variables

• Partials

• Mixins

Page 7: Css to-scss

Nesting

• Your HTML is in a nested hierarchy. Your CSS can be to.

• Write less

• Read more easily

Page 8: Css to-scss

Example

Page 9: Css to-scss

Variables

• Define once, use everywhere

• Control a whole layout or style from a few variables

• Use the variables in calculations, colour modifiers and loads of other operators

Page 10: Css to-scss

Example

Page 11: Css to-scss

Partials and Import

• Split SCSS into manageable chunks.

• Organise your files

• Import open source libraries

Page 12: Css to-scss

Example

Page 13: Css to-scss

Mixins

• Reusable snippets of SCSS

• Prevent repetition

• Use open source mixins to make life easier

Page 14: Css to-scss

Example

Page 15: Css to-scss

How to make the switch

• Install SCSS - sass-lang.com/install

• Convert CSS to SCSS - Just rename .css to .scss

• Generate SCSS - scss styles.scss:styles.css

• Play and learn (and read the docs)

Page 16: Css to-scss

Example

Page 17: Css to-scss

Next steps

• Try SCSS out yourself

• Read the guide at sass-lang.com/guide

• Check out the Frameworks (Compass, Bourbon, Susy)

Page 18: Css to-scss

Questions