9. Who ?
Julien Cabanès
I care about Front End @ZeeAgency
I reply to julien@zeeagency.com
I tweet sometimes @JulienCabanes
I share some code to github.com/ZeeAgency
23. CSS : The Good Parts
• CSS Syntax is easy
• Selector Query Language is nice
• Cascading is nice
• Functions.Yes, CSS have functions
• CSS2 : attr(), counter(), url()
• CSS3 : calc(), translateX(), rotate()...
• Media Queries
• and more...
24. CSS : The Bad Parts
• Variables... come on ! (Still draft)
• Selectors vs. DRY
• Modularity : many files === many HTTP requests
• Functions : Can’t write your owns
• Separation of Concerns is almost impossible
• CSS3 is great but vendors prefixing, damn !
• and more !
36. Quick Overview of CSS Pre-Processors
LESS Stylus Sass/SCSS
Voluntary omitted of
Other/PHP/Python CSS preprocessors
(Turbine, CSS Cacheer...)
37. Quick Overview of CSS Pre-Processors
LESS Stylus Sass/SCSS
Written in JS JS Ruby
38. Quick Overview of CSS Pre-Processors
LESS Stylus Sass/SCSS
Written in JS JS Ruby
39. Quick Overview of CSS Pre-Processors
LESS Stylus Sass/SCSS
Written in JS JS Ruby
Context Front & Local Local / Back Local / Back
40. Quick Overview of CSS Pre-Processors
LESS Stylus Sass/SCSS
Written in JS JS Ruby
Context Front & Local Local / Back Local / Back
Front could be good way to go
if this was a polyfill
but CSS4 doesn’t exist yet
41. Quick Overview of CSS Pre-Processors
LESS Stylus Sass/SCSS
Written in JS JS Ruby
Context Front & Local Local / Back Local / Back
Syntax CSS Superset Not CSS CSS Superset
42. Quick Overview of CSS Pre-Processors
LESS Stylus Sass/SCSS
Written in JS JS Ruby
Context Front & Local Local / Back Local / Back
Syntax CSS Superset Not CSS CSS Superset
Your CSS
won’t work
43. Quick Overview of CSS Pre-Processors
LESS Stylus Sass/SCSS
Written in JS JS Ruby
Context Front & Local Local / Back Local / Back
Syntax CSS Superset Not CSS CSS Superset
Variable Syntax @color: blue; variable = blue $variable: blue;
44. Quick Overview of CSS Pre-Processors
LESS Stylus Sass/SCSS
Written in JS JS Ruby
Context Front & Local Local / Back Local / Back
Syntax CSS Superset JS Like CSS Superset
Variable Syntax @color: blue; variable = blue $variable: blue;
traction
bad abs
45. Quick Overview of CSS Pre-Processors
LESS Stylus Sass/SCSS
Written in JS JS Ruby
Context Front & Local Local / Back Local / Back
Syntax CSS Superset Not CSS CSS Superset
Variable Syntax @color: blue; variable = blue $variable: blue;
Mixins Syntax .foo() {} foo() @mixin foo() {}
46. Quick Overview of CSS Pre-Processors
LESS Stylus Sass/SCSS
Written in JS JS Ruby
Context Front & Local Local / Back Local / Back
Syntax CSS Superset Not CSS CSS Superset
Variable Syntax @color: blue; variable = blue $variable: blue;
Mixins Syntax .foo() {} foo() @mixin foo() {}
implicit abs traction
co uld increase
learni ng cur ve
47. Quick Overview of CSS Pre-Processors
LESS Stylus Sass/SCSS
Written in JS JS Ruby
Context Front & Local Local / Back Local / Back
Syntax CSS Superset Not CSS CSS Superset
Variable Syntax @color: blue; variable = blue $variable: blue;
Mixins Syntax .foo() {} foo() @mixin foo() {}
explicit
ab s traction
48. Quick Overview of CSS Pre-Processors
LESS Stylus Sass/SCSS
Written in JS JS Ruby
Context Front & Local Local / Back Local / Back
Syntax CSS Superset Not CSS CSS Superset
Variable Syntax @color: blue; variable = blue $variable: blue;
Mixins Syntax .foo() {} foo() @mixin foo() {}
Import Style Style Style & Images !
49. Quick Overview of CSS Pre-Processors
LESS Stylus Sass/SCSS
Written in JS JS Ruby
Context Front & Local Local / Back Local / Back
Syntax CSS Superset Not CSS CSS Superset
Variable Syntax @color: blue; variable = blue $variable: blue;
Mixins Syntax .foo() {} foo() @mixin foo() {}
Import Style Style Style & Images !
50. Quick Overview of CSS Pre-Processors
LESS Stylus Sass/SCSS
Written in JS JS Ruby
Context Front & Local Local / Back Local / Back
Syntax CSS Superset Not CSS CSS Superset
Variable Syntax @color: blue; variable = blue $variable: blue;
Mixins Syntax .foo() {} foo() @mixin foo() {}
Import Style Style Style & Images !
Framework Roll your own Roll your own Compass
51. Quick Overview of CSS Pre-Processors
LESS Stylus Sass/SCSS
Written in JS JS Ruby
Context Front & Local Local / Back Local / Back
Syntax CSS Superset Not CSS CSS Superset
Variable Syntax @color: blue; variable = blue $variable: blue;
Mixins Syntax .foo() {} foo() @mixin foo() {}
Import Style Style Style & Images !
Framework Roll your own Roll your own Compass
52. Quick Overview of CSS Pre-Processors
LESS Stylus Sass/SCSS
Run with JS JS Ruby
Context Front & Local Local / Back Local / Back
Syntax More on this later
CSS Superset Not CSS CSS Superset
Variable Syntax @color: blue; variable = blue $variable: blue;
Mixins Syntax .foo() {} foo() @mixin foo() {}
Import Style Style Style & Images !
Framework Roll your own Roll your own Compass
54. Sass
• One language but 2 syntaxes
• Sass : indented syntax, forget { } and ;
• SCSS : Sassy CSS === CSS3 superset
• Means Syntaxically Awesome StyleSheets
• Should run on your machine, not the server
• Is watching for folder/file changes and parse
• Shares a lot of features with LESS & Stylus
55. SCSS is a CSS3 Superset
• Every existing CSS will work just fine !
• You love {...} and ; that’s OK !
• You want a little more ? Try it !
• You want a lot more ? Love it !
71. Interpolation
#{...} can be used for...
$className: 'foo';
$property: 'padding';
p.#{$className} {
#{$property}: 10px;
}
⌘S
Templating ?
p.foo {
padding: 10px;
}
72. Color Operations
Easy to understand
p {
color: #010203 + #040506;
}
a {
color: #010203 * 2;
}
b {
color: rgba(…) + rgba(…);
}
⌘S
p {color: #050709;}
a {color: #020406;}
b {color: rgba(…);}
73. Number Functions
Sounds familiar
round(), ceil(), floor(), abs(), percentage()
$width: 960px;
$columns: 14;
div {
width: round($width / $columns);
}
⌘S
div {
width: 69px;
}