73
Modular CSS / HTML5 Organize the chaos Thursday, September 27, 12

Modular css e html5: organize the chaos

Embed Size (px)

Citation preview

Page 1: Modular css e html5: organize the chaos

ModularCSS / HTML5

Organize the chaos

Thursday, September 27, 12

Page 2: Modular css e html5: organize the chaos

Module

Thursday, September 27, 12

Page 3: Modular css e html5: organize the chaos

is something predetermined,

standard, intended to be repeated several times.

module definition

Thursday, September 27, 12

Page 4: Modular css e html5: organize the chaos

A module is a stand-alone software

component, well identified and easily

reusable

programming

Thursday, September 27, 12

Page 5: Modular css e html5: organize the chaos

stereotype(!)

too complex

woody

too extended

twisted

Thursday, September 27, 12

Page 6: Modular css e html5: organize the chaos

stereotype(!)

too complex

woody

too extended

twisted

good points

essentials

mantianence

readable

reusable

Thursday, September 27, 12

Page 7: Modular css e html5: organize the chaos

when to usemodular CSS?

Thursday, September 27, 12

Page 8: Modular css e html5: organize the chaos

always!

Thursday, September 27, 12

Page 9: Modular css e html5: organize the chaos

choose how to usemodular CSS!

Thursday, September 27, 12

Page 10: Modular css e html5: organize the chaos

A web page is a collection of modules

remind

Thursday, September 27, 12

Page 11: Modular css e html5: organize the chaos

A web page is a collection of modules

remind

Thursday, September 27, 12

Page 12: Modular css e html5: organize the chaos

who I am

Thursday, September 27, 12

Page 14: Modular css e html5: organize the chaos

be precise is anextremely hard work

Thursday, September 27, 12

Page 15: Modular css e html5: organize the chaos

save yourself the trouble

be DRYdon’t repeat yourself

Thursday, September 27, 12

Page 16: Modular css e html5: organize the chaos

Modular HTML5

the age of the hope

Thursday, September 27, 12

Page 17: Modular css e html5: organize the chaos

HTML 4 to 5

Thursday, September 27, 12

Page 18: Modular css e html5: organize the chaos

HTML 4 to 5

Thursday, September 27, 12

Page 19: Modular css e html5: organize the chaos

Roy Tomeij / @roy

Thursday, September 27, 12

Page 20: Modular css e html5: organize the chaos

Roy Tomeij / @roy

All sections can start with <h1>

Screw SEO “experts”

Thursday, September 27, 12

Page 21: Modular css e html5: organize the chaos

choose a side.

In all cases googlewill choose for us!

Thursday, September 27, 12

Page 22: Modular css e html5: organize the chaos

use JS libs as HTML5 SHIV and Modernizer

Thursday, September 27, 12

Page 23: Modular css e html5: organize the chaos

DIVs are not evil

Thursday, September 27, 12

Page 24: Modular css e html5: organize the chaos

Sketching: draw it raw

Thursday, September 27, 12

Page 25: Modular css e html5: organize the chaos

Sketching: draw it raw

Thursday, September 27, 12

Page 26: Modular css e html5: organize the chaos

Sketching: draw it raw

Thursday, September 27, 12

Page 27: Modular css e html5: organize the chaos

define your objects

Thursday, September 27, 12

Page 28: Modular css e html5: organize the chaos

define your objects

Thursday, September 27, 12

Page 29: Modular css e html5: organize the chaos

define your objects

Thursday, September 27, 12

Page 30: Modular css e html5: organize the chaos

“NO Style”markup

Thursday, September 27, 12

Page 31: Modular css e html5: organize the chaos

“NO Style”markup

Thursday, September 27, 12

Page 32: Modular css e html5: organize the chaos

finally: a module

Thursday, September 27, 12

Page 33: Modular css e html5: organize the chaos

finally: a module

Thursday, September 27, 12

Page 34: Modular css e html5: organize the chaos

thinkobject oriented

“OO”

Thursday, September 27, 12

Page 35: Modular css e html5: organize the chaos

OO is made in ourimage and likeness

don’t be scareddiscover it

http://processing.org/learning/objects/

Thursday, September 27, 12

Page 36: Modular css e html5: organize the chaos

God was the nerd of all nerds because he made the

universe in justsix days using OO!

Thursday, September 27, 12

Page 37: Modular css e html5: organize the chaos

Spaghetti Code

vs

MVC

Thursday, September 27, 12

Page 38: Modular css e html5: organize the chaos

<?php

?>

query.sql + functions(){$variables + <tables> +} + <div style=””> + $_GLOBALS + <<<EOF + js

(early 2000’s style)

Thursday, September 27, 12

Page 39: Modular css e html5: organize the chaos

Rails MVCmodel, view, controller

separating db, logic & presentation

an eye opener in 2007

Thursday, September 27, 12

Page 40: Modular css e html5: organize the chaos

CSS good practices

Thursday, September 27, 12

Page 41: Modular css e html5: organize the chaos

CSS good practices

Oh, no! AGAIN?!?

Thursday, September 27, 12

Page 42: Modular css e html5: organize the chaos

find a strong RESET

Thursday, September 27, 12

Page 43: Modular css e html5: organize the chaos

I do prefer classesinstead of IDs

Thursday, September 27, 12

Page 44: Modular css e html5: organize the chaos

be verbose naming classes and assets

Thursday, September 27, 12

Page 45: Modular css e html5: organize the chaos

selectorsthe greats unknown

learn how to use’em

Thursday, September 27, 12

Page 46: Modular css e html5: organize the chaos

if you need!IMPORTANT

there’s something wrong

Thursday, September 27, 12

Page 47: Modular css e html5: organize the chaos

SASS / Scss

can’t live without you

Thursday, September 27, 12

Page 48: Modular css e html5: organize the chaos

•variables like $white: #FFF

•math like 10px + 10px = 20px

•@mixins as functions ($with_params)

•logic like IF/ELSE FOR

•nested classes•compiled css extended or compact

SASS features

Thursday, September 27, 12

Page 49: Modular css e html5: organize the chaos

SCSSexamplecompiled

Thursday, September 27, 12

Page 50: Modular css e html5: organize the chaos

SCSSexamplecompiled

Thursday, September 27, 12

Page 51: Modular css e html5: organize the chaos

Modular CSSone module = one class = one file

Thursday, September 27, 12

Page 52: Modular css e html5: organize the chaos

•base•layout•modules•sections•themes

Structure

Thursday, September 27, 12

Page 53: Modular css e html5: organize the chaos

•base•layout•modules•sections•themes

Structure

Thursday, September 27, 12

Page 54: Modular css e html5: organize the chaos

•base•layout•modules•sections•themes

Structure

Thursday, September 27, 12

Page 55: Modular css e html5: organize the chaos

•base•layout•modules•sections•themes

Structure

Thursday, September 27, 12

Page 56: Modular css e html5: organize the chaos

•base•layout•modules•sections•themes

Structure

Thursday, September 27, 12

Page 57: Modular css e html5: organize the chaos

•base•layout•modules•sections•themes

Structure

Thursday, September 27, 12

Page 58: Modular css e html5: organize the chaos

•base•layout•modules•sections•themes

Structure

Thursday, September 27, 12

Page 59: Modular css e html5: organize the chaos

the bridging technique @import every single scss

to your application.css

Thursday, September 27, 12

Page 60: Modular css e html5: organize the chaos

bridging: before / after

Thursday, September 27, 12

Page 61: Modular css e html5: organize the chaos

bridging: before / after

Thursday, September 27, 12

Page 62: Modular css e html5: organize the chaos

application.scss

Thursday, September 27, 12

Page 63: Modular css e html5: organize the chaos

application.scss

Thursday, September 27, 12

Page 64: Modular css e html5: organize the chaos

application.scss

Thursday, September 27, 12

Page 65: Modular css e html5: organize the chaos

5 reasons to bridge

Thursday, September 27, 12

Page 66: Modular css e html5: organize the chaos

5 reasons to bridge

•clean file•manteinance•readable•performance•caching

Thursday, September 27, 12

Page 67: Modular css e html5: organize the chaos

Responsivedesign

Thursday, September 27, 12

Page 68: Modular css e html5: organize the chaos

Responsiveain’t so easy!

Thursday, September 27, 12

Page 69: Modular css e html5: organize the chaos

media queries

belong to a module, so keep them within the

same scope

Thursday, September 27, 12

Page 70: Modular css e html5: organize the chaos

media queries

belong to a module, so keep them within the

same scope

Thursday, September 27, 12

Page 71: Modular css e html5: organize the chaos

Happy ending“After having built a few hundreds

of sites I would have discovered the “one true way” of doing it.

I don’t think there is one true way”

(Scalable and Modular Architecture for CSS - Jonathan Snook)

Thursday, September 27, 12

Page 72: Modular css e html5: organize the chaos

Better Software 2012

firenze

Thursday, September 27, 12

Page 73: Modular css e html5: organize the chaos

Better Software 2012

firenze

www.cantierecreativo.net

Thursday, September 27, 12