creating responsive drupal sites with zen grids and the zen 5 theme

32
Creating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme John Albin Wilkins and Dana DeMet Palantir.net

Upload: acquia

Post on 28-Jan-2015

121 views

Category:

Technology


0 download

DESCRIPTION

Too many responsive websites fall into the "move the sidebars around" trap and end up looking the same as any other responsive site. By combining the CSS of Zen Grids and the smart markup of the Zen 5 theme, you can create a stellar, unique responsive design for your website with ease.Zen has always been a popular starting point for building Drupal themes, but the new Zen 5 has been re-written from the ground-up with updated best practices including HTML5, Modernizr integration, Normalize, IE conditional classes, responsive layouts, and, best of all, Sass and Compass integration.Zen Grids is an all new project, independent from the Zen theme. The Zen Grids system reinvents the flexible, but complicated CSS layout method in old versions of the Zen theme, transforming it into a radically simplified process using the power of Sass. Where traditional grid systems (like 960.gs) often don't scale to match a responsive design's requirements, Zen Grids makes it incredibly easy to create amazing responsive layouts in just a couple lines of code.

TRANSCRIPT

Page 1: Creating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme

Creating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme John Albin Wilkins and Dana DeMetPalantir.net

Page 2: Creating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme

About Palantir.net• Founded in 1996; working with Drupal since

2006

• Web strategy, design, and development firm

• Team of senior-level Drupal and Web experts

• Leading contributors to Drupal core, contributed modules, and community

• Enterprise Select Acquia Partner

Page 3: Creating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme

Palantir and Responsive Design• Responsive Web Design is the sustainable

approach for building “mobile-first” sites

• The mobile device landscape is growing and changing rapidly

• Zen 5 and Zen Grids are built to embrace that change

• Zen 5 and Zen Grids are battle-tested and ready to use today

Page 4: Creating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme

http://drupal.org/project/zen

Over 700,000

downloads!

Page 5: Creating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme

+Zen 7.x-5.0 is the 5th major release.

Page 6: Creating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme

++ Sass

+ Compass

+ HTML5 Shiv

+ Normalize.css+ Respond.js

+ IE Conditional Classes

+ Drush+ Mobile First

+ Responsive Design+ Zen Grids

+ RTL

+ ARIA

+ Accessibility

Page 7: Creating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme

drupal.org/project/fences

Page 8: Creating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme

Drupal 7<div class="field-field-NAME"> <div class="field-label"> LABEL:&nbsp; </div>

<div class="field-items"> <div>VALUE 1</div> <div>VALUE 2</div> </div></div>

<h3 class="field-label"> LABEL</h3>

<ELEMENT class="field-NAME"> VALUES</ELEMENT>

Drupal 7 + Fences

Page 9: Creating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme

Building a Responsive Drupal Site1.Configure Drupal fields with Fences

2.Build a Zen sub-theme

3.Design your layouts with Zen Gridsand Sass

Page 10: Creating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme

Building a Responsive Drupal Site1.Configure Drupal fields with Fences

2.Build a Zen sub-theme

3.Design your layoutswith Zen Gridsand Sass

Page 11: Creating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme

Guiding principle of Zen

Zen makes no assumptions about your content and your design.It does the most minimally useful thing for all designs and then gets the hell out of your way.

http://palantir.net/blog/all-new-zen-same-guiding-principles

Page 12: Creating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme

Guiding principle of Zen

Lean, semantic HTML5 markup

Flexible, light-weight responsive framework

http://palantir.net/blog/all-new-zen-same-guiding-principles

Page 13: Creating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme

Drush + Zen = ♡

> drush dl zen (download Zen)

> drush cc all (clear the cache)

> drush zen "My First Sub-theme" first--description="Our example theme."--without-rtl

Starter kit for "My First Sub-theme" created in:/sites/all/themes/first

Page 14: Creating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme

Configure your sub-theme

/admin/appearance

Page 15: Creating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme

Turn off “Add Respond.js” if you want to use a custom

Modernizr script.

Configure your sub-theme

Page 16: Creating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme

Re-thinkingResponsive Techniques

Page 17: Creating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme

Natural vs. Unnatural Breakpoints

http://www.palantir.net/blog/re-thinking-breakpoints-responsive-design

Page 18: Creating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme

%-based gutters

Page 19: Creating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme

%-based gutters

• They suck.

Page 20: Creating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme

%-based gutters

Page 21: Creating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme

em or px-based gutters

box-sizing: border-box;

http://paulirish.com/2012/box-sizing-border-box-ftw/

Set your gutter (padding) in em or

px.Set your column

widths in %.

Page 22: Creating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme

The obvious layout method:region-based layouts

“Multi-Device Layout Patterns”http://www.lukew.com/ff/entry.asp?1514

Stark in

Drupal 8Stark in

Drupal 8

Page 23: Creating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme

Field-based layoutsEach field becomes a grid item

http://www.palantir.net/experience

Page 24: Creating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme

+

A Drupal ProjectA Sass/Compass

Project

Page 25: Creating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme

Zen Grids is a separate project

http://zengrids.com

( but it’s included with the Zen theme )

Page 26: Creating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme

Writing raw layout CSS is hard• Writing 3 to 5 separate

layouts with raw CSS is really, really, really, really, really hard.

• Sass makes its easy.

• Sass is just CSS syntax + awesomesauce.

• Learning Sass will save you time. Immediately.

Page 27: Creating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme

Sass in 2 minutes• Variables

$blue: #3bbfce;

.text { color: $blue;}.box { border-color: $blue;}

.text { color: #3bbfce;}.box { border-color: #3bbfce;}

• Mixins@mixin left($distance) { float: left; margin-left: $distance;}

.picture { @include left(10px);}

.picture { float: left; margin-left: 10px;}

http://sass-lang.com

Page 28: Creating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme

Sass in 2 minutes

• Write in Sass.

• Have a Sass utility generate the CSS.

• Deploy the CSS.

http://sass-lang.com

Page 29: Creating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme

Compass in 1 minute• Compass is a library of pre-defined Sass mixins.

• Includes CSS3 mixins. ( Never have to mess with vendor prefixes again. )

• Includes vertical rhythm helper mixins.

• Includes standardized IE Legacy variables. (Turn on or off IE 6/7/8 support with ease.)$legacy-support-for-ie6: false;

• Includes image sprite generation mixins.

• Zen Grids requires Compass.

http://compass-style.org

Page 30: Creating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme

Installation

• Command-line junkies:Install Compass and Sass for free at:http://sass-lang.com/tutorial.htmlAnd then run:gem install compassgem install zen

• Command-line haters:Get Fire.app for $14 at:http://fireapp.handlino.com

Page 31: Creating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme

Zen Grids LIVE DEMO!

http://zengrids.com

Page 32: Creating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme

Thanks!

John Albin WilkinsFollow me on Twitter @JohnAlbin

Visit Palantir at www.palantir.netFollow us on Twitter @palantir