CUBE CSS

A presentation at Technica11y in July 2020 in by Andy Bell

Slide 1

Slide 1

CUBE CSS July 1st 2020 #technica11y

Slide 2

Slide 2

CSS Doesn’t Scale!

Slide 3

Slide 3

Just use Tailwind Just use Emotion Just use Styled components Just use CSS Modules

Slide 4

Slide 4

Tailwind CSS default output: 80,936 lines, 102kb weight https://unpkg.com/tailwindcss@1.4.6/dist/tailwind.css

Slide 5

Slide 5

npm init -y

Slide 6

Slide 6

WordPress 36%

React JS 0.3%

Slide 7

Slide 7

body { content: “How Andy Does it” }

Slide 8

Slide 8

Slide 9

Slide 9

What is CUBE CSS?

Slide 10

Slide 10

C Composition Utility U Block B Exception E

Slide 11

Slide 11

The “C” in CSS stands for “Cascading”

Slide 12

Slide 12

CSS + CUBE =

Slide 13

Slide 13

CSS

Slide 14

Slide 14

CSS scales Beautifully

Slide 15

Slide 15

Slide 16

Slide 16

Slide 17

Slide 17

CSS

Slide 18

Slide 18

Progressive Enhancement for the win

Slide 19

Slide 19

Composition

Slide 20

Slide 20

Micro

Macro

Slide 21

Slide 21

Design System Work is often diplomacy work

Slide 22

Slide 22

Slide 23

Slide 23

Provide high-level, flexible layouts Determine how elements interact with each other Create consistent flow and rhythm

Slide 24

Slide 24

Provide visual treatment such as colour or font style Provide decorative styles such as shadows and patterns Force a browser to generate a pixelperfect layout

Slide 25

Slide 25

Slide 26

Slide 26

Featuring Heydon Pickering https://every-layout.dev

Slide 27

Slide 27

Simplify and distill layout Hints & rules, rather than micromanaging Achieves solid, resillient layouts

Slide 28

Slide 28

Simplify and distill layout Hints & rules, rather than micromanaging Achieves solid, resillient layouts

Slide 29

Slide 29

Simplify and distill layout Hints & rules, rather than micromanaging Achieves solid, resillient layouts

Slide 30

Slide 30

Featuring Heydon Pickering https://every-layout.dev

Slide 31

Slide 31

Slide 32

Slide 32

Slide 33

Slide 33

Slide 34

Slide 34

Slide 35

Slide 35

CSS

Slide 36

Slide 36

HTML

Slide 37

Slide 37

Utility

Slide 38

Slide 38

Image: thedrum.com

Slide 39

Slide 39

CSS

Slide 40

Slide 40

Design Tokens

Slide 41

Slide 41

“Design Tokens are the visual atoms of the design system – specifically, they are named entities that store visual design attributes. We use them in place of hard–coded values in order to maintain a scalable and consistent visual system.” @jina

Slide 42

Slide 42

Design tokens for scalable systems

Slide 43

Slide 43

JSON

Slide 44

Slide 44

CSS

Slide 45

Slide 45

HTML

Slide 46

Slide 46

Design tokens mean light CSS

Slide 47

Slide 47

Apply a single CSS property, or a concise group of related properties Extend design tokens to maintain a single source of truth Abstract repeatability away from the CSS and apply it in the HTML instead

Slide 48

Slide 48

Define a large group of unrelated CSS properties. Be used as a specificity hack.

Slide 49

Slide 49

Block

Slide 50

Slide 50

Slide 51

Slide 51

CUBE CSS BEM

Slide 52

Slide 52

Bring your own opinions (slightly risky)

Slide 53

Slide 53

CSS

Slide 54

Slide 54

CSS

Slide 55

Slide 55

Extend the work already done by CSS, composition and utility Apply a collection of design tokens within a concise group Create a namespace or specificity boost

Slide 56

Slide 56

Grow to anything larger than a handful of CSS rules (max 80-100 lines) Solve more than one contextual problem

Slide 57

Slide 57

Exception

Slide 58

Slide 58

Slide 59

Slide 59

Slide 60

Slide 60

HTML

Slide 61

Slide 61

CSS

Slide 62

Slide 62

Principles

Slide 63

Slide 63

Pls do this layout thx

Slide 64

Slide 64

Progressive Enhancement for the win

Slide 65

Slide 65

https://swop.link/pe

Slide 66

Slide 66

Bye Bye AutoPrefixer we will not miss you

Slide 67

Slide 67

Abstraction only when necessary

Slide 68

Slide 68

Any technology is fine just keep the output light

Slide 69

Slide 69

Wrapping up

Slide 70

Slide 70

IT’S A LIE

Slide 71

Slide 71

Slide 72

Slide 72

https://cube.fyi

Slide 73

Slide 73

Thank you Use code TECHNICA11Y_PALS to save 40% off Learn Eleventy From Scratch https://swop.link/11ty-cube

Slide 74

Slide 74

Slide 75

Slide 75

Thank you Use code TECHNICA11Y_PALS to save 40% off Learn Eleventy From Scratch https://swop.link/11ty-cube