Slide 1

Slide 1 text

No content

Slide 2

Slide 2 text

Brian Graves @briangraves

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

CSS in 2015 is Amazing.

Slide 11

Slide 11 text

WHERE HAVE WE BEEN?

Slide 12

Slide 12 text

There is No CSS3! And other facts about how standards are made.

Slide 13

Slide 13 text

Despite the popularity of the “CSS3” buzzword, there is actually no spec defining such a thing. – Lea Verou

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

Animation

Slide 17

Slide 17 text

Typography

Slide 18

Slide 18 text

Layout

Slide 19

Slide 19 text

“CSS is not a real programming language”

Slide 20

Slide 20 text

Problems with CSS • Cross-browser compatibility issues • Vendor prefixes • No variables • No inline importing • No nested selectors • No functions/mixins • No color manipulation • No basic arithmetic

Slide 21

Slide 21 text

Rise of the Preprocessors. How we filled in the gaps.

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

.row { @include display-flex; background-color: $color-blue; } .row { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex; background-color: #173fb1; }

Slide 26

Slide 26 text

Preprocessors Perpetuate A Problem. – Aaron Ladage

Slide 27

Slide 27 text

More & More Layers of Abstraction

Slide 28

Slide 28 text

Problems with Preprocessors • Not “real” code • Proprietary syntax • Often written in non front-end languages • Not as easily extensible • Must be compiled • Compile times can be slow • Browsers are catching up

Slide 29

Slide 29 text

Preprocessors? Where we’re going, we don’t need preprocessors.

Slide 30

Slide 30 text

THE FUTURE OF CSS IS NOW

Slide 31

Slide 31 text

Variables

Slide 32

Slide 32 text

Color Functions

Slide 33

Slide 33 text

Nesting

Slide 34

Slide 34 text

Custom Media Queries

Slide 35

Slide 35 text

PostCSS

Slide 36

Slide 36 text

.row { @include display-flex; background: $color-blue; } .row { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex; background-color: #173fb1; }

Slide 37

Slide 37 text

.row { display: flex; background: var(—color-blue); } .row { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex; background-color: #173fb1; }

Slide 38

Slide 38 text

PostCSS Advantages • Write CSS using CSS • Use CSS3 without worry • Even Use CSS4 • Modular • Works with your existing task runner • Faster compile times • Built on Node • No Ruby dependencies • Easier to debug • Tons of existing plugins • Can’t find a plugin? Write one in javascript.

Slide 39

Slide 39 text

Autoprefixer

Slide 40

Slide 40 text

PostCSS Ecosystem • Autoprefixer • PostCSS-nested • PostCSS-color-function • PostCSS-calc • PostCSS-custom-properties • PostCSS-mixins • PostCSS-custom-media • CSSNext • PostCSS-import • Can’t find a plugin? Write one in javascript.

Slide 41

Slide 41 text

Variables

Slide 42

Slide 42 text

:root { --color-blue: #0A81C4; --color-blue-dark: #005581; } .element { color: var(--color-blue); } .element:hover { color: var(--color-blue-dark); }

Slide 43

Slide 43 text

Variables lose their value if you have to constantly track down what they represent. – Ryan Heap

Slide 44

Slide 44 text

Color Functions

Slide 45

Slide 45 text

.element { color: #1982C5; } .element-modifier { color: color(#1982C5 tint(40%)); }

Slide 46

Slide 46 text

.element { color: #1982C5; } .element-modifier { color: color(#1982C5 shade(40%)); }

Slide 47

Slide 47 text

CSS Color Functions • Tints & Shades • RGBA Adjustment • HSL/HWB Adjustment • Color Blending (blend & blenda) • Guarantee Contrast

Slide 48

Slide 48 text

/* combine with variables to create palettes */ :root { --color-blue: #1982C5; --color-blue-light: color( var(--color-blue) tint(40%) ); --color-blue-dark: color( var(--color-blue) shade(40%) ); }

Slide 49

Slide 49 text

/* map variables to variables */ :root { --color-text: var(--color-blue); --color-text-light: color( var(--color-text) tint(40%) ); --color-text-dark: color( var(--color-text) shade(40%) ); }

Slide 50

Slide 50 text

/* map variables to variables */ :root { --color-text: var(--color-orange); --color-text-light: color( var(--color-text) tint(40%) ); --color-text-dark: color( var(--color-text) shade(40%) ); }

Slide 51

Slide 51 text

Nesting

Slide 52

Slide 52 text

.element { color: blue; {&.modifier { color: red; }} }

Slide 53

Slide 53 text

.element { color: blue; {&.modifier { color: red; }} }

Slide 54

Slide 54 text

.element { color: blue; &.modifier { color: red; } }

Slide 55

Slide 55 text

.im { .a { .way { .over { .nested { .selector { color: red; } } } } } }

Slide 56

Slide 56 text

Custom Media Queries

Slide 57

Slide 57 text

@custom-media --small (min-width: 450px); @media (--small) { .element { font-size: 22px; } }

Slide 58

Slide 58 text

@media only screen and (min-width: 450px) { .element { font-size: 22px; } }

Slide 59

Slide 59 text

@custom-media --small (min-width: 450px); @media (--small) { .element { font-size: 22px; } }

Slide 60

Slide 60 text

New Media Query Syntax

Slide 61

Slide 61 text

@media (width >= 450px) and (width <= 600px) { .element { font-size: 22px; } }

Slide 62

Slide 62 text

@media (min-width: 450px) and (max-width: 600px) { .element { font-size: 22px; } }

Slide 63

Slide 63 text

Partials & Globbing

Slide 64

Slide 64 text

/* generated with grunt-sass-globbing */ @import "utilities/variables"; @import "utilities/mixins"; @import "utilities/reset"; @import “utilities/breakpoints"; @import “atoms/buttons"; @import “atoms/headings"; @import “atoms/icons"; @import “atoms/text"; @import “molecules/components/disclaimer“; …

Slide 65

Slide 65 text

Mixins

Slide 66

Slide 66 text

Problems with CSS • Cross-browser compatibility issues • Vendor prefixes • No variables • No inline importing • No nested selectors • No functions/mixins • No color manipulation • No basic arithmetic

Slide 67

Slide 67 text

One Day…

Slide 68

Slide 68 text

Let’s Get As Close As We Can To The Real Language

Slide 69

Slide 69 text

@briangraves Thank You!