My presentation is available for download from here: http://snugug.com/musings/nyc-camp-presentation
Mobile matters. There are more than 4x the number mobile devices activated each day than there babies born and the question of how to effectively deliver your content to everyone, regardless of how they get there, should be the most important question for product owners and developers today. Enter responsive design.
Responsive design comes from the idea that there is not a mobile web and a desktop web but instead a single, unified web. The most obvious new design paradigm to come from this new thinking are websites that are not built on a fixed width grid but rather one that expands and contracts depending on how much screen real estate is available to the current user. To be able to do this, however, you want a powerful set of tools at your disposal in order to aid in you in the large amount of work needed to build a responsive design. Enter Sass+Compass
Sass 3.2 introduces a number of new features designed specifically to aid in responsive design including the ability to modularize your media queries and call them on-demand or to write media queries based on calculations in your Sass files. Compass v0.12 improves upon Compass's already impecable mixin and function libraries with a large update to Compass's Image Sprite functionality, a traditionally hard technique made drop-dead easy and essential to the Mobile First Responsive Design philosophy that should be taken when designing websites.
Compass also allows us to tap into all a community of extensions to make your lives easier, including some that are specifically designed to help us with responsive design, including Susy for fluid grids, Breakpoint and Respond-To to name and manage media queries, and RWD Kickstart to get you up and running from scratch with best practices quickly as quickly as possible.
Drupal 7 also provides us with some capability to greatly reduce the development costs for our mobile-first development, including some great projects including HTML5 Project for clean, semantic HTML5 markup, the Borealis Suite for semantic blocks and mobile-first responsive images, and Drupal 7's awesome new AJAX system to assist in lazy loading content, reducing download size and speed.
2. WHO AM I?
Sam Richard Organizer of NYC
Responsive Web Design
Frontend Developer Meetup
@Snugug on Twitter Co-Organizer of NYC Sass
Meetup
Snugug on D.O.
Co-Organizer of SassConf
Very Sassy Man
Sunday, July 22, 12
3. WHAT IS THIS SESSION?
I WILL: I WON’T:
Give you an overview of Try and convince you
some tools and to start building
techniques for RWD Responsively
Show you how to use Teach the basics of
Sass+Compass in new Sass+Compass
and exciting ways for
RWD and Progressive Show you how to
Enhancement compile Sass with
Drupal
Sunday, July 22, 12
4. WHAT FEATURES DO YOU NEED FOR
RESPONSIVE WEB DESIGN?
As outlined in Ethan Marcotte’s Phrase-Coining A List Apart
article, Responsive Web Design needs the three following
things:
Fluid Grids
Media Queries
Flexible Media
Sunday, July 22, 12
5. WHAT PRINCIPLES DO YOU NEED
FOR RESPONSIVE WEB DESIGN?
Design your websites for Mobile First
Make Content and Navigation primary concerns over visual flair
and social sharing
Embrace Progressive Enhancement and build on standard
Web technologies (HTML/CSS/JS)
Design on a grid, ideally one specific to your design
Design in Browser
Sunday, July 22, 12
7. THE TOOLS OF THE TRADE
Sass+Compass Modern Web Browser (I like
Google Chrome)
Susy Compass Extension
LiveReload
Breakpoint / Respond-to
Compass Extensions Adobe Shadow + Devices
Toolkit Compass Extension Illustrator for creating vector
graphics
Modernizr
Text Editor (I like TextMate or
Sublime Text)
Sunday, July 22, 12
8. STUFF TO AVOID
Browser Plugins (like Flash and Silverlight)
Single browser prefixes (just -webkit, just -moz, etc…)
CSS Frameworks
The phrase “Pixel Perfect”
Photoshop
Designing around known devices
Device Detection
Sunday, July 22, 12
9. The web is an inherently unstable
medium
Ethan Marcotte
Sunday, July 22, 12
11. The point of creating [responsive] sites is to create
functional (and hopefully optimal) user experiences for a
growing number of web-enabled devices and contexts.
Brad Frost
Sunday, July 22, 12
12. Repeat after me: Responsive Web Design isn’t
about current devices and known unknowns, it’s
about future devices and unknown unknowns.
Donald Rumsfeld
Sunday, July 22, 12
13. Your device detection is bad and
you should feel bad
Dr. John A. Zoidberg
Sunday, July 22, 12
14. BEFORE YOU GO ANYWHERE, LET’S
CHEAT AT CSS
@import 'compass';
* { @include box-sizing('border-box'); }
// From Paul Irish's Blog Post
Sunday, July 22, 12
15. SUSY
FLUID GRIDS FULL OF WIN
> gem install susy --pre
require 'susy'
@import "susy";
$total-columns: 12;
$column-width: 4em;
$gutter-width: 1em;
$grid-padding: $gutter-width;
Sunday, July 22, 12
16. SUSY
FLUID GRIDS FULL OF WIN
#page-wrapper {
@include container;
}
#main {
@include span-columns(8);
}
#sidebar-first {
@include span-columns(4 omega);
}
Sunday, July 22, 12
25. RESPOND-TO
SEMANTIC BREAKPOINT NAMING
$breakpoints: 'inline main navigation' (482px),
'inline main navigation, floated right' (823px);
#main-nav {
clear: both;
li {
display: block;
@include respond-to('inline main navigation') {
display: inline-block;
}
@include respond-to('inline main navigation, floated right') {
@include span-columns(9 omega);
}
}
}
Sunday, July 22, 12
26. TOOLKIT
FOR MODERN WEB DEVELOPMENT
> gem install toolkit
require 'toolkit'
Sunday, July 22, 12
27. A NOTE ON RESPONSIVE MEDIA
Sass will not magically give you Responsive Media. Neither will
Compass, Modernizr, any CSS or JS Framework, or even Drupal.
For Responsive Media to be a reality, we need a new browser
based standard. There are currently some proposed solutions
for Images, and Apple is forging ahead with a non-standard
solution in iOS6, but until then, everything is a hack.
There are some tricks you can do in CSS to make media Fluid,
however, and Sass rocks at this.
Sunday, July 22, 12
28. TOOLKIT
FOR FLUID MEDIA
@import "toolkit/fluid-media";
// Included Automatically
img {
max-width: 100%;
height: auto;
}
.bar {
.foo {
@include scale-
@include scale-elements;
elements($ratio: 4/3);
}
}
Sunday, July 22, 12
34. TOOLKIT
TO KICKSTART YOUR DEVELOPMENT
Existing Project
require 'toolkit'
> compass install toolkit
- or -
> compass install toolkit/respond-to
New Project
> compass create <my_project> -r toolkit --using toolkit
- or -
> compass create <my_project> -r toolkit --using
toolkit/respond-to
Sunday, July 22, 12
35. TOOLKIT
TO KICKSTART YOUR DEVELOPMENT
Compass Development Modernizr
Build with yepnope
Toolkit
loader.js to hold yepnope
Susy tests
Either Breakpoint or hammer.js for touch events
Respond-to
Sass stylesheets and
Border Box Box Model default, empty partials
Sunday, July 22, 12
36. DID I MENTION…
Everything you just saw? Yah, it’s all backend independent. You
can use it anywhere, with anything, for any project. Sass Rocks.
Sunday, July 22, 12
37. GO FORTH, BE RESPONSIVE, AND
MAY THE SASS BE WITH YOU
People to Follow: If you liked this talk, I’m Sam
@Snugug, @Compass, @TheSassWay, Richard. If not, I was Mason
@GoTeamSass, @CodingDesigner,
@ScottKellum, @ItsMissCS, Wendell.
@ChrisEppstein, @nex3, @beep,
@lukew, @brad_frost, @globalmoxie
If you have questions, come
to my BoFs tomorrow or
Things to Read:
http://snugug.com/rwd find me. I’m happy to talk.
http://snugug.com/pe-pattern
http://snugug.com/breakpoint
http://snugug.com/toolkit
Please rate this session
http://snugug.com/rwd-mobile (and all of the others)!
http://snugug.com/munich Thank you!
Sunday, July 22, 12