!
Hammering Responsive
Web Design Into Shape	

!
!
@KenTabor
Visionary
bit.ly/KenSlideShare
Adapt Respond Overcome
โ€œRecently, an emergent discipline called
โ€˜responsive architectureโ€™ has begun
asking how physical spaces can respond
to the presence of people passing
through them.โ€ 	

-Ethan Marcotte
โ€œRather than tailoring disconnected
designs to each of an ever-increasing
number of web devices, we can treat
them as facets of the same experience.โ€ 	

-Ethan Marcotte
I ๏ฌgure you already buy into
responsive, adaptive, or ๏ฌ‚uid
design
Letโ€™s focus on the challenge of
RWD - testing against a
multitude of form-factors
Production servers are sweet
for users
Production servers are a drag
for testing
Get your own server	

Install Apache
Win7? 	

Download the installer at
httpd.apache.org
OS X?	

Apache is already on your
MacBook
Apache con๏ฌguration is not
ideal out of the box	

Letโ€™s tell Apache from where
to serve your ๏ฌles
Edit what? httpd.conf	

Where?	

c:apache2conf	

/etc/apache2/
#Before
DocumentRoot โ€œ/Library/WebServer/
Documentsโ€
!
#After
DocumentRoot โ€œ/Users/ken/treesโ€
#Before
<Directory โ€œ/Library/WebServer/
Documentsโ€>โ€จ
!
#Afterโ€จ
<Directory โ€œ/Users/ken/treesโ€>
After editing httpd.conf
restart Apache
Localhost, the best host โค๏ธ	

Rapid turn around and
absolute control
Level Up
Leapfrog your peers?	

Gain advantage over the
competition?
Serve your teammates?	

Share with the community?
Will the mobile browser on
phones and tablets hit our
work OS X laptop?
Yes! And itโ€™s fantastic!
Laptop is on wi๏ฌ	

iPhone is on wi๏ฌ	

Shared network is easiest
System Preferences	

Network
http://192.168.0.244
Phone or tablet browser hits
the laptop URL	

Tickles Apache to serve
Laptop + Devices => #Joy
Will the mobile browser on
phones and tablets hit our
work Win7 laptop?
Laptop is on wi๏ฌ	

iPhone is on wi๏ฌ	

Shared network is easiest
Firewall turned off	

Phone or tablet browser hits
the laptop URL 	

Tickles Apache to serve
Open a Command Prompt	

โ€œipconfigโ€
Look for ip address
Expert pro-tip:Apache web
server โ€œVirtual Hostโ€
This is optional	

Adds power-up bonus points
Maps (a folder)	

/Users/ken/trees/AnnaSpellingWords	

to (a URL)	

www.annaspellingwords.local
Edit: httpd-vhosts.conf	

Where?	

c:apache2confextra	

/etc/apache2/extra
<VirtualHost *:80>โ€จ
DocumentRoot โ€œ/Users/ken/trees/AnnaSpellingWordsโ€โ€จ
ServerName annaspellingwords.local
!
<Directory โ€œ/Users/ken/trees/AnnaSpellingWordsโ€>โ€จ
Options Indexes FollowSymLinksโ€จ
AllowOverride Allโ€จ
Order allow,denyโ€จ
Allow from allโ€จ
</Directory>โ€จ
</VirtualHost>
Edit what? httpd.conf	

Where?	

c:apache2conf	

/etc/apache2/
# Virtual hosts
Include /private/etc/apache2/extra/
httpd-vhosts.conf
Edit: hosts	

Where?	

windowssystem32driversetc	

/etc
127.0.0.1 annaspellingwords.local
When youโ€™re back home and in
the lab enjoy a coffee	

Experiment and have fun
Who is โ€œKen Tabor?โ€
Iโ€™m a product engineer	

at Sabre building TripCase
Internet Inspirations
mediaqueri.es
responsivedesign.is
html5up.net
responsive.is
Responsive Testing Tool
Easily preview your site given
typical device resolutions	

Runs on localhost for
convenience & security
github.com/mattkersley/
Responsive-Design-Testing
ResponsizerJS
Drop it into your web site	

Helps resize browser when
matching device sizes
github.com/KDawg/
Responsizer.js
<script src=โ€œresources/code/
Responsizer.jsโ€
type=โ€œtext/javascriptโ€>
</script>
Canโ€™t ๏ฌnd the right tool? 	

Then build it and share!
How big are your users?
How do we know the screen
sizes and devices our
customers have?
Using Google Analytics?	

You have a wealth of data	

Draw reports on it
Screen Size	

Device Brand	

O/S Name &Version	

Browser Type
Using this data informs your
interface design with fact-based
reality
Surviving CSS by thriving with
Sass
sass-lang.com
Lovely syntactic sugar	

Compiles to CSS	

Makes life more joyful
$phone-width: 320px;โ€จ
$laptop-width: 1024px;
!
.popup {โ€จ
left: 25%;โ€จ
position: fixed;โ€จ
width: 50%;โ€จ
z-index: 20;โ€จ
โ€จ
@media screen and (max-width: $phone-width) {โ€จ
left: 10%;โ€จ
width: 80%;โ€จ
}โ€จ
โ€จ
@media screen and (min-width: $laptop-width) {โ€จ
font-size: 2em;โ€จ
left: 15%;โ€จ
width: 70%;โ€จ
}โ€จ
}
Nested media queries	

Expressive variables	

More rational looking
Breakpoint
breakpoint-sass.com
$phone-width: max-width 320px;โ€จ
$laptop-width: min-width 1024px;โ€จ
โ€จ
.popup {โ€จ
left: 25%;โ€จ
position: fixed;โ€จ
width: 50%;โ€จ
z-index: 20;โ€จ
โ€จ
@include breakpoint($phone-width) {โ€จ
left: 10%; โ€จ
width: 80%;โ€จ
}โ€จ
โ€จ
@include breakpoint($laptop-width) {โ€จ
font-size: 2em;โ€จ
left: 15%;โ€จ
width: 70%;โ€จ
}โ€จ
}
Fun with PhantomJS
phantomjs.org
Headless Webkit browser
phantomjs.org/download.html
brew install phantomjs
Take screen shots of websites	

Record at varying device sizes
Needs some JavaScript
coding to be the awesome
var webpage = require('webpage');โ€จ
var page;โ€จ
โ€จ
page = webpage.create();
page.viewportSize = {width: 1024, height: 768};
page.clipRect = {top: 0, left: 0,
width: 1024, height: 768};
โ€จ
page.open('http://www.microsoft.com', function() {โ€จ
page.render('screenie_1024_768.png');โ€จ
phantom.exit();โ€จ
});
phantomjs screenie.js
Script could take parameters: 	

width and height	

url	

picture ๏ฌlename
ImageMagick processing
imagemagick.org
Selection of command-line
image processing tools
www.imagemagick.org/script/
binary-releases.php
brew install imagemagick
Compare two images	

Produce a third one	

โ€œAnnotates distortionsโ€
XOR Bitwise Operator
0 XOR 0 = false
0 XOR 1 = true
1 XOR 0 = true
1 XOR 1 = false
compare image1.png
image2.png image3.png
Automate this	

Collect visual history	

Detect design divergence
Responses?
!
Have Fun!
bit.ly/KenSlideShare	

!
!
@KenTabor

WVPDX 2014 - Hammering Responsive Web Design Into Shape