CSS PREPROCESSORS Michael and Miles. Overview What are CSS Preprocessors Why use them? What is LESS...

10
CSS PREPROCESSORS Michael and Miles

Transcript of CSS PREPROCESSORS Michael and Miles. Overview What are CSS Preprocessors Why use them? What is LESS...

Page 1: CSS PREPROCESSORS Michael and Miles. Overview What are CSS Preprocessors Why use them? What is LESS and how to use LESS example What is SASS and how to.

CSS PREPROCESSORS

Michael and Miles

Page 2: CSS PREPROCESSORS Michael and Miles. Overview What are CSS Preprocessors Why use them? What is LESS and how to use LESS example What is SASS and how to.

Overview

• What are CSS Preprocessors• Why use them?• What is LESS and how to use• LESS example• What is SASS and how to use• SASS example

Page 3: CSS PREPROCESSORS Michael and Miles. Overview What are CSS Preprocessors Why use them? What is LESS and how to use LESS example What is SASS and how to.

What are CSS Preprocessors

• Tools for development• Language compilation CSS• Gives more functionality to CSS• Dynamic style sheets • CSS properties as variables• Fewer lines of code

Page 4: CSS PREPROCESSORS Michael and Miles. Overview What are CSS Preprocessors Why use them? What is LESS and how to use LESS example What is SASS and how to.
Page 5: CSS PREPROCESSORS Michael and Miles. Overview What are CSS Preprocessors Why use them? What is LESS and how to use LESS example What is SASS and how to.

Why use preprocessors?

• Developers turning to toolkits• Create more manageable, reusable, compact style

sheets• Faster development time• Saves from monotony• More time for creativity and back-end development• Programmatic CSS features

Page 6: CSS PREPROCESSORS Michael and Miles. Overview What are CSS Preprocessors Why use them? What is LESS and how to use LESS example What is SASS and how to.

LESS

• Inspired by SASS• Developed by Alexis Sellier in 2009• Originally in Ruby on Rails, replaced by JavaScript• Open source on GitHub• Uses stylesheet.LESS extension• JavaScript compiles LESS code into regular CSS on the

fly• variables, mix ins, operations and nested rules• Nice debug feature

Page 7: CSS PREPROCESSORS Michael and Miles. Overview What are CSS Preprocessors Why use them? What is LESS and how to use LESS example What is SASS and how to.

• Variables in LESS, use the @ symbol– @maincolor: #232323– Global styles– Define once, use anywhere– Change once, update everywhere

• Mix-ins• Classes injected into other classes• Reusable snippets of code• Optional parameters

• Nesting• Gives your CSS hierarchy• Stack child elements into parent element

• Operators

Page 8: CSS PREPROCESSORS Michael and Miles. Overview What are CSS Preprocessors Why use them? What is LESS and how to use LESS example What is SASS and how to.

SASS

• Created by Hampton Catlin• Further designed by Nathan Weizenbaum and Chris

Eppstein• Uses .SCSS or .SASS extensions• Must be compiled into a CSS file• Variables, if else statements, loops, mix ins, etc.• 100% CSS3 compliant

Page 9: CSS PREPROCESSORS Michael and Miles. Overview What are CSS Preprocessors Why use them? What is LESS and how to use LESS example What is SASS and how to.

Two syntaxes, who can live at this speed?

• Indented syntax (.SASS)– Much different from traditional CSS syntax– No curly braces or semi colons– More strict

• Sassy CSS (SCSS)– Superset of CSS– If you know css, already writing in SCSS– Easier to work with existing CSS

• Both are completely valid and neither will be depracated

Page 10: CSS PREPROCESSORS Michael and Miles. Overview What are CSS Preprocessors Why use them? What is LESS and how to use LESS example What is SASS and how to.

Summary

• LESS and SASS features• Dynamic style sheets• Faster development• Less code• Reusability