Slide 1

Slide 1 text

The purification of web development

Slide 2

Slide 2 text

Nicolas Gallagher @necolas

Slide 3

Slide 3 text

Before code…

Slide 4

Slide 4 text

Assumptions and the history of ideas

Slide 5

Slide 5 text

Heraclitus (535 BC – 475 BC)

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

Democritus (460 BC – 370 BC)

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

“You cannot step twice into the same river; for fresh waters are flowing in upon you.” – Heraclitus

Slide 11

Slide 11 text

CSS and the purification of HTML

Slide 12

Slide 12 text

Slide 13

Slide 13 text

“To increase the granularity of control over elements, a new attribute has been added to HTML: 'CLASS'.” - CSS1 spec

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

Don’t use “unsemantic” class names?

Slide 16

Slide 16 text

“Your HTML, like diamonds, should be forever.” - camendesign.com

Slide 17

Slide 17 text

“…authors are encouraged to use [class attribute] values that describe the nature of the content, rather than values that describe the desired presentation of the content.” - HTML5 spec

Slide 18

Slide 18 text

“A structure based on CLASS is only useful within a restricted domain, where the meaning of a class has been mutually agreed upon.” - CSS1 spec

Slide 19

Slide 19 text

Class names are for us, not machines

Slide 20

Slide 20 text

We can pick our own meaning

Slide 21

Slide 21 text

Don't write ugly class names?

Slide 22

Slide 22 text

Slide 23

Slide 23 text

/* Component */ .button {…} /* Component */ .button-group {…} /* Component modifier */ .button.primary {…} /* Component child */ .button-group .item {…}

Slide 24

Slide 24 text

/* Component */ .Button {…} /* Component modifier */ .Button--primary {…} /* Component */ .ButtonGroup {…} /* Component descendant */ .ButtonGroup-item {…}

Slide 25

Slide 25 text

  • Save
  • Cancel

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

github.com/necolas/suit-button-group

Slide 28

Slide 28 text

github.com/necolas/suit

Slide 29

Slide 29 text

Structured class names are useful

Slide 30

Slide 30 text

Don’t use extra elements?

Slide 31

Slide 31 text

Close
...

Slide 32

Slide 32 text

{{> partials/close-button }}
{{$content}}{{/content}}

Slide 33

Slide 33 text

{{Title

Some words

{{/content}} {{/box_with_close}}

Slide 34

Slide 34 text

Look at what they make you give

Slide 35

Slide 35 text

Web Components

Slide 36

Slide 36 text

“Web Components…let web application authors define widgets with a level of visual richness not possible with CSS alone” - W3C Introduction to Web Components

Slide 37

Slide 37 text

“…specify the extra presentation using markup…” - W3C Introduction to Web Components

Slide 38

Slide 38 text

No content

Slide 39

Slide 39 text

Encapsulation, interoperability, reuse

Slide 40

Slide 40 text

Shadow DOM Encapsulation and DOM boundaries Custom elements; extend native elements Clonable, inert DOM fragments

Slide 41

Slide 41 text

@host { /* css to unstyle button */ } .visHidden { /* css to hide text */ }
// javascript

Slide 42

Slide 42 text

Close

Slide 43

Slide 43 text

No content

Slide 44

Slide 44 text

It’s ok to rely on extra elements

Slide 45

Slide 45 text

Step back into the river

Slide 46

Slide 46 text

The end