responsive web design with django, compass, and the less framework

82
RESPONSIVE WEB DESIGN S M L XL with Django, Compass, and the Less Famework

Upload: idan-gazit

Post on 24-Mar-2015

2.589 views

Category:

Documents


1 download

DESCRIPTION

My talk from DjangoCon Europe 2011

TRANSCRIPT

Page 1: Responsive Web Design with Django, Compass, and the Less Framework

RESPONSIVEWEBDESIGN

S M L XL

with Django, Compass, and the Less Famework

Page 2: Responsive Web Design with Django, Compass, and the Less Framework
Page 3: Responsive Web Design with Django, Compass, and the Less Framework

http://ic.kr/p/dwY5M

RAISE YOUR HANDS IF…

S M L XL

Page 4: Responsive Web Design with Django, Compass, and the Less Framework

the

WHYthe

HOW

Page 5: Responsive Web Design with Django, Compass, and the Less Framework

http://j.mp/responsive-ALA

Page 8: Responsive Web Design with Django, Compass, and the Less Framework

NOW YOU HAVE TWO PROBLEMS.

Page 9: Responsive Web Design with Django, Compass, and the Less Framework

NOW YOU HAVE THREE PROBLEMS.

Page 10: Responsive Web Design with Django, Compass, and the Less Framework

NOW YOU HAVE THREE PROBLEMS.

Page 11: Responsive Web Design with Django, Compass, and the Less Framework

NOW YOU HAVE FIVE PROBLEMS?

Page 12: Responsive Web Design with Django, Compass, and the Less Framework

NOW YOU HAVE FIVE PROBLEMS?

Page 13: Responsive Web Design with Django, Compass, and the Less Framework

NOW YOU HAVE MORE TARGETS.

Page 14: Responsive Web Design with Django, Compass, and the Less Framework

http://ic.kr/p/6iLEF

DESKTOP?

Page 15: Responsive Web Design with Django, Compass, and the Less Framework

http://ic.kr/p/6iLEF

DESKTOP?

Page 16: Responsive Web Design with Django, Compass, and the Less Framework

BEST VIEWED AT…

Page 17: Responsive Web Design with Django, Compass, and the Less Framework

FIXED LAYOUTS

960px

1024px 1600px

960px

Page 18: Responsive Web Design with Django, Compass, and the Less Framework

FLUID LAYOUTS

90%920px

1024px

90%1440px

1600px

Page 19: Responsive Web Design with Django, Compass, and the Less Framework

LARGE

Screen Size

SMALL

Page 20: Responsive Web Design with Django, Compass, and the Less Framework

FIXEDPARTIAL

CONTENT

FIXED OR FLUID

Page 21: Responsive Web Design with Django, Compass, and the Less Framework

OK OKFAIL FAIL

Page 22: Responsive Web Design with Django, Compass, and the Less Framework

OK OKFAIL FAIL

WHY?

Page 23: Responsive Web Design with Django, Compass, and the Less Framework

CONTINUOUSSPECTRUM

LARGEScreen SizeSMALL

Page 24: Responsive Web Design with Django, Compass, and the Less Framework

CONTINUOUSSPECTRUM

LARGEScreen SizeSMALL

Page 25: Responsive Web Design with Django, Compass, and the Less Framework

CONTINUOUSSPECTRUM

Page 26: Responsive Web Design with Django, Compass, and the Less Framework

CSS3 MEDIA QUERIEShttp://www.w3.org/TR/css3-mediaqueries/

Page 27: Responsive Web Design with Django, Compass, and the Less Framework

IPHONE

@media only screen and (max-width: 767px) { … }

LANDSCAPE IPHONE

@media only screen and (min-width: 480px) and(max-width: 767px) { … }

IPAD

@media only screen and (min-width: 768px) and(max-width: 1023px) { … }

Page 28: Responsive Web Design with Django, Compass, and the Less Framework

WELL,IE9 IS OK

Page 29: Responsive Web Design with Django, Compass, and the Less Framework
Page 30: Responsive Web Design with Django, Compass, and the Less Framework

PROGRESSIVEENHANCEMENT

DEFAULT CSS @MEDIA@MEDIA@MEDIAIE <9.0

Page 31: Responsive Web Design with Django, Compass, and the Less Framework
Page 32: Responsive Web Design with Django, Compass, and the Less Framework
Page 33: Responsive Web Design with Django, Compass, and the Less Framework

WHAT RESPONDS?Typogaphy (typeface, size, leading)

Layout (margins, padding, loats)

Paint (background images, colors)

… basically, style.

Page 34: Responsive Web Design with Django, Compass, and the Less Framework
Page 35: Responsive Web Design with Django, Compass, and the Less Framework
Page 36: Responsive Web Design with Django, Compass, and the Less Framework
Page 37: Responsive Web Design with Django, Compass, and the Less Framework
Page 38: Responsive Web Design with Django, Compass, and the Less Framework

http://mediaqueri.es

iPhone

iPaddesktop

widescreen

Page 39: Responsive Web Design with Django, Compass, and the Less Framework

WHAT DOESN’T?

Page 40: Responsive Web Design with Django, Compass, and the Less Framework

LARGE<IMG>DATA

http://ic.kr/p/354RJ2

Page 41: Responsive Web Design with Django, Compass, and the Less Framework

RESPONSIVE** not a utopia

Page 42: Responsive Web Design with Django, Compass, and the Less Framework

“RESPONSIVE” DOES NOT SOLVE CONTENT ISSUES

Page 43: Responsive Web Design with Django, Compass, and the Less Framework

“RESPONSIVE” DOES NOT SOLVE USABILITY ISSUES

Page 44: Responsive Web Design with Django, Compass, and the Less Framework

“RESPONSIVE” DOES NOT SOLVE CREATES NEW ISSUES

Page 45: Responsive Web Design with Django, Compass, and the Less Framework

“RESPONSIVE” IS JUST MODERN WEB DESIGN

Page 46: Responsive Web Design with Django, Compass, and the Less Framework

http://ic.kr/p/FNeQW

Page 47: Responsive Web Design with Django, Compass, and the Less Framework

YOU ROLL YOUR OWNFor science. You masochist.

Page 48: Responsive Web Design with Django, Compass, and the Less Framework

http://compass-style.org

http://sass-lang.com

Sass.

Page 49: Responsive Web Design with Django, Compass, and the Less Framework

@impot "compass/reset";@impot "compass/css3/tansition";@impot "compass/utilities/geneal/cleafix";@impot "compass/layout/grid-background";@impot "compass/utilities/color/contast";@impot "compass/css3/border-adius";@impot "compass/css3/images";

@impot "patials/base";@impot "less/famework";@impot "patials/more";

@impot "patials/exams/pygmentstheme";@impot "patials/exams/global";@impot "patials/exams/default";@impot "patials/exams/tablet";@impot "patials/exams/mobile";@impot "patials/exams/wide-mobile";//@impot "patials/high-px-atio";

Page 50: Responsive Web Design with Django, Compass, and the Less Framework

from css impot reset, shotcuts

from thirdpaty_app impot some_utilities

from my_app impot desktop, tablet, mobile

Page 51: Responsive Web Design with Django, Compass, and the Less Framework
Page 52: Responsive Web Design with Django, Compass, and the Less Framework

I WILL NEVER(wilingly)

DEVELOP WITHOUT COMPASS AGAIN

, EVER

Page 53: Responsive Web Design with Django, Compass, and the Less Framework

I WILL NEVER(wilingly)

DEVELOP WITHOUT COMPASS AGAINYES, IT’S THAT GOOD

, EVER

Page 54: Responsive Web Design with Django, Compass, and the Less Framework

SIGH, RUBY.expot GEM_HOME="$VIRTUAL_ENV/gems"expot GEM_PATH=""

Stick this in vitualenv’s postactivate script.

Page 55: Responsive Web Design with Django, Compass, and the Less Framework

SIGH, RUBY.expot GEM_HOME="$VIRTUAL_ENV/gems"expot GEM_PATH=""

Stick this in vitualenv’s postactivate script.

Now go PayPal @carljm some beer money.

Page 56: Responsive Web Design with Django, Compass, and the Less Framework

$ gem install compass

Page 57: Responsive Web Design with Django, Compass, and the Less Framework

$ gem install compass-less-plugin

http://lessfamework.comhttps://github.com/wilhw/compass-less-plugin

Page 58: Responsive Web Design with Django, Compass, and the Less Framework

10

8

Page 59: Responsive Web Design with Django, Compass, and the Less Framework

5

3

Page 60: Responsive Web Design with Django, Compass, and the Less Framework

MORE IS LESShttps://gist.github.com/1009952

Inspired by 960 and Susy

Page 61: Responsive Web Design with Django, Compass, and the Less Framework

COMPILED CSSHow does I manage it?

→ GHETTO STUPID WAY → SHINY FUTURE WAY

Page 62: Responsive Web Design with Django, Compass, and the Less Framework

PROJECT/app1/app2settings.py/static ← in STATICFILES_DIRS /img /js /css/static_root ← STATIC_ROOT

Page 63: Responsive Web Design with Django, Compass, and the Less Framework

$ compass create -r less foo --using less$ mv foo/sass sass$ mv foo/config.rb .$ rm -f foo

Page 64: Responsive Web Design with Django, Compass, and the Less Framework

/app1/app2settings.pyconfig.rb/sass screen.scss ← @impots the patias /patials _base.scss _global.scss _default.scss _mobile.scss/static /img /js /css screen.css ← geneated by compass

Page 65: Responsive Web Design with Django, Compass, and the Less Framework

SHINY FUTURE WAY?django-compressor

Page 66: Responsive Web Design with Django, Compass, and the Less Framework

{% load compress %}{% compress css %}<link rel="stylesheet" href="path/to/mycompass.scss">{% endcompress %}

COMPRESS_CSS_FILTERS = [ 'compressor.filters.compass.CompassFilter',]

settings.py

template.html

Page 67: Responsive Web Design with Django, Compass, and the Less Framework

high-px-atiowide-mobilemobiletabletdefaultglobal

Page 68: Responsive Web Design with Django, Compass, and the Less Framework

high-px-atiowide-mobilemobiletabletdefaultglobal

Page 69: Responsive Web Design with Django, Compass, and the Less Framework

3 5 8 10mobile wide mobile tablet desktop

https://github.com/idangazit/wd_example

Page 70: Responsive Web Design with Django, Compass, and the Less Framework

<body> <div id="wap"> <header> <h1>How are you gentlemen?</h1> </header> <div class="odd" id="foo">...</div> <div class="even" id="bar">...</div> <div class="odd" id="baz">...</div> <div class="even" id="spam">...</div> </div></body>

Page 71: Responsive Web Design with Django, Compass, and the Less Framework

<body> <div id="wap"> <header> <h1>How are you gentlemen?</h1> </header> <div class="odd" id="foo">...</div> <div class="even" id="bar">...</div> <div class="odd" id="baz">...</div> <div class="even" id="spam">...</div> </div></body>

Page 72: Responsive Web Design with Django, Compass, and the Less Framework

<body> <div id="wap"> <header> <h1>How are you gentlemen?</h1> </header> <div class="odd" id="foo">...</div> <div class="even" id="bar">...</div> <div class="odd" id="baz">...</div> <div class="even" id="spam">...</div> </div></body>

Page 73: Responsive Web Design with Django, Compass, and the Less Framework

header>h1 { // global masthead styling}.even, .odd { font-family: Georgia, Times, serif; margin-bottom: 4.0em; h1 { padding: 10px; font-size: 1.75em; color: #FBED64; } p { padding: 10px; line-height: 1.3em; color: rgba(255,255,255,0.75); }}

_global.scss

Page 74: Responsive Web Design with Django, Compass, and the Less Framework

#{$less-grid-element} { @include grid(10); @include less-grid-background(10); }

header>h1 { font-size: 6.0em; margin-bottom: 0.5em; margin-top: 0.5em; }

.even, .odd { @include columns(5); }

.even { @include omega; }

_default.scss

Page 75: Responsive Web Design with Django, Compass, and the Less Framework

@media only screen and (max-width: 767px) { #{$less-grid-element} { @include grid(3); @include less-grid-background(3); }

header>h1 { font-size: 4.0em; margin-bottom: 0.3em; margin-top: 0.3em; }

.even, .odd { @include columns(3); margin-bottom: 1.0em; @include omega; }}

_mobile.scss

Page 76: Responsive Web Design with Django, Compass, and the Less Framework

3 5 8 8mobile wide mobile tablet desktop

https://github.com/idangazit/wd_example

Page 77: Responsive Web Design with Django, Compass, and the Less Framework

RESPONSIVE** It’s a cool technique

Page 78: Responsive Web Design with Django, Compass, and the Less Framework
Page 79: Responsive Web Design with Django, Compass, and the Less Framework

?

Page 80: Responsive Web Design with Django, Compass, and the Less Framework

MOBILE RESPONSIVE

Page 81: Responsive Web Design with Django, Compass, and the Less Framework

IGNORE THE HYPEBe aware of this technique

I think it’s the quiet future of web design

Page 82: Responsive Web Design with Django, Compass, and the Less Framework

KTHXBAI!Idan Gazit → @idangazit

ig