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

http://d.fastcompany.net/multisite_files/fastcompany/imagecache/1280/poster/2015/11/3054003-poster-p-1-dont-give-a-hoverboard-this-christmas.jpg

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

https://lh3.googleusercontent.com/-jijITfbqlCk/UUeCfITz0wI/AAAAAAAAQuc/1PjBKq-6KzM/s630-fcrop64=1%2C000033fafffff833/135486852774.jpg

Slide 14

Slide 14 text

The Web

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

Text Documents credit

Slide 17

Slide 17 text

Text Documents credit

Slide 18

Slide 18 text

Tables

Slide 19

Slide 19 text

Absolute Positioning / Floats / Inline-Block

Slide 20

Slide 20 text

Flexbox / Grids

Slide 21

Slide 21 text

CSS in 2016 is Amazing.

Slide 22

Slide 22 text

WHERE HAVE WE BEEN?

Slide 23

Slide 23 text

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

Slide 24

Slide 24 text

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

Slide 25

Slide 25 text

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

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

No content

Slide 30

Slide 30 text

Animation

Slide 31

Slide 31 text

Typography

Slide 32

Slide 32 text

Shapes

Slide 33

Slide 33 text

Grids

Slide 34

Slide 34 text

“CSS is not a real language”

Slide 35

Slide 35 text

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

Slide 36

Slide 36 text

Things That Make Our Lives Easier

Slide 37

Slide 37 text

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

Slide 38

Slide 38 text

No content

Slide 39

Slide 39 text

No content

Slide 40

Slide 40 text

No content

Slide 41

Slide 41 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 42

Slide 42 text

Do Preprocessors Solve The Problem?

Slide 43

Slide 43 text

Preprocessors Perpetuate A Problem. – Aaron Ladage

Slide 44

Slide 44 text

More & More Layers of Abstraction

Slide 45

Slide 45 text

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

Slide 46

Slide 46 text

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

Slide 47

Slide 47 text

THE FUTURE OF CSS IS NOW

Slide 48

Slide 48 text

Variables

Slide 49

Slide 49 text

Mixins/Extends

Slide 50

Slide 50 text

Color Functions

Slide 51

Slide 51 text

Nesting

Slide 52

Slide 52 text

Custom Media Queries

Slide 53

Slide 53 text

No content

Slide 54

Slide 54 text

Custom Properties (Variables)

Slide 55

Slide 55 text

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

Slide 56

Slide 56 text

Just because you may like Sass variable syntax more does not mean that you should just forsake the new spec. – Jake Albaugh http://codepen.io/jakealbaugh/post/css4-variables-and-sass

Slide 57

Slide 57 text

http://caniuse.com/#feat=css-variables Browser Support: Custom Properties

Slide 58

Slide 58 text

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

Slide 59

Slide 59 text

Bad --blue: #0A81C4; --blue2: #005581; --blue3: #acd5f8; --timing: .25s; --othertiming: 1s; Good: Logical Modifiers --color-blue: #0A81C4; --color-blue-light: #005581; --color-blue-dark: #acd5f8; --timing-fast: .25s; --timing-slow: 1s; Good: Point Scale --color-blue-10: #0A81C4; --color-blue-20: #005581; --color-blue-30: #acd5f8;

Slide 60

Slide 60 text

No content

Slide 61

Slide 61 text

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

Slide 62

Slide 62 text

@Apply (Mixins/Extends)

Slide 63

Slide 63 text

:root { --clearfix: { display: table; clear: both; content: ‘’; }; } .element:after { @apply --clearfix; }

Slide 64

Slide 64 text

https://www.chromestatus.com/feature/5753701012602880 Browser Support: @apply

Slide 65

Slide 65 text

Color Module Level 4 (Color Functions)

Slide 66

Slide 66 text

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

Slide 67

Slide 67 text

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

Slide 68

Slide 68 text

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

Slide 69

Slide 69 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 70

Slide 70 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 71

Slide 71 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 72

Slide 72 text

Nesting

Slide 73

Slide 73 text

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

Slide 74

Slide 74 text

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

Slide 75

Slide 75 text

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

Slide 76

Slide 76 text

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

Slide 77

Slide 77 text

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

Slide 78

Slide 78 text

Bad Nesting Order .selector { element {//…} property: value; .selector {//…} &:before {//…} } Good Nesting Order .selector { property: value; &:before {//…} element {//…} .selector {//…} }

Slide 79

Slide 79 text

Custom Selectors

Slide 80

Slide 80 text

@custom-selector --small (min-width: 30em); @media (--small) { .element { font-size: 1.5rem; } }

Slide 81

Slide 81 text

@media only screen and (min-width: 30em) { .element { font-size: 1.5rem; } }

Slide 82

Slide 82 text

@custom-selector --small (min-width: 30em); @media (--small) { .element { font-size: 1.5rem; } }

Slide 83

Slide 83 text

@custom-selector --heading h1,h2,h3,h4,h5,h6; --heading { /* styles for all headings */ } --heading + p { /* more styles */ }

Slide 84

Slide 84 text

Media Query Range Context

Slide 85

Slide 85 text

@media (30em <= width <= 60em) { .element { font-size: 1.5rem; } }

Slide 86

Slide 86 text

@media (min-width: 30em) and (max-width: 60em) { .element { font-size: 1.5rem; } }

Slide 87

Slide 87 text

@media (width <= 30em) { …small… } @media (30em < width < 60em) { …medium… } @media (width >= 60em) { …large… }

Slide 88

Slide 88 text

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

Slide 89

Slide 89 text

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

Slide 90

Slide 90 text

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

Slide 91

Slide 91 text

Autoprefixer

Slide 92

Slide 92 text

Autoprefixer

Slide 93

Slide 93 text

PostCSS

Slide 94

Slide 94 text

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

Slide 95

Slide 95 text

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

Slide 96

Slide 96 text

PostCSS Advantages • Write CSS using CSS • Use CSS3 without worry • Even Use CSS4 • Modular (Use only what you need) • Tons of existing plugins • Can’t find a plugin? Write one in javascript.

Slide 97

Slide 97 text

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

Slide 98

Slide 98 text

One Day…

Slide 99

Slide 99 text

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

Slide 100

Slide 100 text

@briangraves Slides: bit.ly/2dn48Fb Thank You!