this talk is aimed at those
 who already know their
    way around Drupal
I'm a themer
I want to get rid of themers
I may need to explain myself
who does what
in the Drupal world
developer              themer

        site builder            designer
developer
site builder
custom theme
themer

         designer
the theme system is…
       complex
a front-end developer
who has been forced
to learn PHP in order
     to cope with
  the theme system
themer

         designer
themer

         designer
driesnote™
“Are Drupal's custom
  content types and views
   popular because they
 eliminate the developer?
I think the answer is 'yes'.”
I don't think we can
get rid of developers
developer              themer

        site builder            designer
here's how to get rid
  of your themer
designer
your designer writes
 HTML, CSS and JS
your designer writes
fantastic HTML, CSS and JS
understands content and
writes semantic markup
writes re-usable CSS
using a preprocessor
keeps the front-end lean,
efficient and responsive
they use whatever technique
   is best for the project
BUZZWORD
BINGO!
semantic markup
   SMACSS / OOCSS
     preprocessor
asynchronous javascript
 content out approach
Preprocessors                       Static page generators             Static image prototyping
Sass — CSS preprocessing            Hammer for Mac http://             InvisionApp — very slick —
Less — similar to Sass              hammerformac.com/                  http://invisionapp.com/
Stylus — a good but less popular    Middleman — a bit more complex     Shipment — nice dropbox
preprocessor                        — requires command line http://    integration — http://
Susy/Singularity/ZenGrids/          middlemanapp.com/                  blog.shipmentapp.com/
GridSet — grid system               CodeKit — http://incident57.com/   Browsers
generators                          codekit/index.php                  Chrome — Supports Sass in the
Compass — add-on functionality      Mixture.io http://mixture.io/      web inspector — needs sass
for Sass like vertical rhythm,      Serve — Riby gem https://          debugging turned on
sprites, css3 etc                   github.com/gummesson/serve         Canary — Same as above but
Bourbon — Similar to Compass        Testing                            also supports source maps
much to their dismay                Live Reload                        Safari — can use the desktop
Toolkit — A few nice extras to      Guard — command line tool,         web inspector on the remote
have — https://github.com/          faster than live-reload            iphone/ipad site
Snugug/toolkit                      Adobe Edge Inspect — http://       Browser Extentions
CSS Frameworks                      html.adobe.com/edge/inspect/       Web Inspector — needs sass
SMACSS — styleguide/                Mixture.io — http://mixture.io/    debugging turned on and
framework for developing css        Virtual Box with Windows XP and    experimental mode
that is both modular and scalable   snapshots with IE6, IE7, IE8       Speed Tracer
OOCSS — object orientaed CSS        Lots of devices                    YSlow
— more strict than smacss           Typography                         Adobe edge Inspect
Styleguide generation               typecast — http://typecast.com/    Live Reload
KSS — uses comments in files to     — can preview fast                 Visual design and layout
generate a styleguide — http://     Colour                             Fireworks — for working out
warpspire.com/posts/kss/            Kuler — https://kuler.adobe.com/   Photoshop — mainly for image
Typecast — quick way to             Colour Lovers — http://            manipulation
generate styles for type            www.colourlovers.com/              InDesign — some very useful
Clarify — http://www.clarify.io     Color Scheme Designer — http://    tools for wireframes
Style-Sites — https://github.com/   colorschemedesigner.com/           Illustrator — creating SVG files
snugug/style-sites                  http://color.hailpixel.com/        and illustrations
                                                                       UXPin — http://uxpin.com/
designs a system
hands HTML, CSS and JS
 over to the site builder
CSS and JS go
into the theme

HTML is used as
a markup guide
the developer sets one or
     two things up*

     *can be done in advance
developer
required code
a theme
base theme?
<div id="page-wrapper"><div id="page">

    <div id="header"><div class="section clearfix">

      <?php if ($logo): ?>
        <a href="<?php print $front_page; ?>" title="<?php
print t('Home'); ?>" rel="home" id="logo">
          <img src="<?php print $logo; ?>" alt="<?php print
t('Home'); ?>" />
        </a>
      <?php endif; ?>

      <?php if ($site_name || $site_slogan): ?>
        <div id="name-and-slogan">
          <?php if ($site_name): ?>
            <?php if ($title): ?>
              <div id="site-name"><strong>
                <a href="<?php print $front_page; ?>" title="<?
<?php
print $content;
<div id="<?php print $block_html_id; ?>" class="<?php print
$classes; ?>"<?php print $attributes; ?>>
  <?php print render($title_prefix); ?>
<?php if ($block->subject): ?>
  <h2<?php print $title_attributes; ?>><?php print $block-
>subject ?></h2>
<?php endif;?>
  <?php print render($title_suffix); ?>

  <div class="content"<?php print $content_attributes; ?>>
    <?php print $content ?>
  </div>
</div>
<?php
print $content;
a layout or two
/**
  * Implements hook_ctools_plugin_api().
  */
function ce_panels_ctools_plugin_api($module, $api) {
   if ($module == 'panels' && $api == 'styles') {
     return array('version' => 2.0);
   }
   if ($module == 'page_manager' && $api == 'pages_default') {
     return array('version' => 1);
   }
   if ($module == "panels_mini" && $api == "panels_default") {
     return array("version" => "1");
   }
}

/**
  * Implements hook_ctools_plugin_directory()
  */
function ce_panels_ctools_plugin_directory($module, $plugin) {
   if ($module == 'page_manager' || $module == 'panels' || $module == 'ctools') {
     return $plugin;
   }
}
<?php
/**
 * @file
 * Layout definition for Code Enigma one column layout.
 */

/**
 * Panel layout definition.
 */
$plugin = array(
  'title'    => t('Code Enigma One Column'),
  'category' => t('Code Enigma'),
  'icon'     => 'ce_one_column.png',
  'theme'    => 'ce_one_column',
  'regions' => array(
    'content'         => t('Content'),
  ),
);
<?php
/**
 * @file
 * Layout template for Code Enigma one column layout.
 *
 * Regions:
 * - content
 */

if (isset($content['content'])) {
  print $content['content'];
}
a method for turning of all
   supplied CSS and JS
site builder
required modules
display suite
 semantic views
      panels
panels everywhere
 semantic panels*

 *using a forked version atm
<img width="120" height="289" alt="Aliquam bene"
 src="/files/my_image.jpg" />
<div class="field field-name-field-image field-type-image
field-label-hidden">
  <div class="field-items">
    <div resource="/files/my_image.jpg" rel="og:image
     rdfs:seeAlso" class="field-item even">
         <img width="120" height="289" alt="Aliquam bene"
          src="/files/my_image.jpg" typeof="foaf:Image">
    </div>
  </div>
</div>
site builder
designer
some rules
never write a .tpl.php
never write a .tpl.php
unless you really have to
start by outputting no
     markup at all
add markup via the UI
think carefully about where
  you add your wrappers
why is this good?
give designers freedom
make things easy for
   site builders
makes adding markup
     consistent
avoids the temptation to do
  things in the theme you
        shouldn't do
do we actually do this?
no
we keep the themer
questions
exit

James Panton
  @mcjim

Death of a Themer

  • 1.
    this talk isaimed at those who already know their way around Drupal
  • 2.
  • 3.
    I want toget rid of themers
  • 4.
    I may needto explain myself
  • 5.
    who does what inthe Drupal world
  • 6.
    developer themer site builder designer
  • 7.
  • 8.
  • 9.
  • 10.
    themer designer
  • 11.
    the theme systemis… complex
  • 12.
    a front-end developer whohas been forced to learn PHP in order to cope with the theme system
  • 13.
    themer designer
  • 14.
    themer designer
  • 15.
  • 17.
    “Are Drupal's custom content types and views popular because they eliminate the developer? I think the answer is 'yes'.”
  • 18.
    I don't thinkwe can get rid of developers
  • 19.
    developer themer site builder designer
  • 21.
    here's how toget rid of your themer
  • 22.
  • 23.
    your designer writes HTML, CSS and JS
  • 24.
  • 25.
  • 26.
  • 27.
    keeps the front-endlean, efficient and responsive
  • 28.
    they use whatevertechnique is best for the project
  • 29.
  • 30.
    semantic markup SMACSS / OOCSS preprocessor asynchronous javascript content out approach
  • 31.
    Preprocessors Static page generators Static image prototyping Sass — CSS preprocessing Hammer for Mac http:// InvisionApp — very slick — Less — similar to Sass hammerformac.com/ http://invisionapp.com/ Stylus — a good but less popular Middleman — a bit more complex Shipment — nice dropbox preprocessor — requires command line http:// integration — http:// Susy/Singularity/ZenGrids/ middlemanapp.com/ blog.shipmentapp.com/ GridSet — grid system CodeKit — http://incident57.com/ Browsers generators codekit/index.php Chrome — Supports Sass in the Compass — add-on functionality Mixture.io http://mixture.io/ web inspector — needs sass for Sass like vertical rhythm, Serve — Riby gem https:// debugging turned on sprites, css3 etc github.com/gummesson/serve Canary — Same as above but Bourbon — Similar to Compass Testing also supports source maps much to their dismay Live Reload Safari — can use the desktop Toolkit — A few nice extras to Guard — command line tool, web inspector on the remote have — https://github.com/ faster than live-reload iphone/ipad site Snugug/toolkit Adobe Edge Inspect — http:// Browser Extentions CSS Frameworks html.adobe.com/edge/inspect/ Web Inspector — needs sass SMACSS — styleguide/ Mixture.io — http://mixture.io/ debugging turned on and framework for developing css Virtual Box with Windows XP and experimental mode that is both modular and scalable snapshots with IE6, IE7, IE8 Speed Tracer OOCSS — object orientaed CSS Lots of devices YSlow — more strict than smacss Typography Adobe edge Inspect Styleguide generation typecast — http://typecast.com/ Live Reload KSS — uses comments in files to — can preview fast Visual design and layout generate a styleguide — http:// Colour Fireworks — for working out warpspire.com/posts/kss/ Kuler — https://kuler.adobe.com/ Photoshop — mainly for image Typecast — quick way to Colour Lovers — http:// manipulation generate styles for type www.colourlovers.com/ InDesign — some very useful Clarify — http://www.clarify.io Color Scheme Designer — http:// tools for wireframes Style-Sites — https://github.com/ colorschemedesigner.com/ Illustrator — creating SVG files snugug/style-sites http://color.hailpixel.com/ and illustrations UXPin — http://uxpin.com/
  • 32.
  • 33.
    hands HTML, CSSand JS over to the site builder
  • 34.
    CSS and JSgo into the theme HTML is used as a markup guide
  • 35.
    the developer setsone or two things up* *can be done in advance
  • 36.
  • 37.
  • 38.
  • 39.
  • 41.
    <div id="page-wrapper"><div id="page"> <div id="header"><div class="section clearfix"> <?php if ($logo): ?> <a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" rel="home" id="logo"> <img src="<?php print $logo; ?>" alt="<?php print t('Home'); ?>" /> </a> <?php endif; ?> <?php if ($site_name || $site_slogan): ?> <div id="name-and-slogan"> <?php if ($site_name): ?> <?php if ($title): ?> <div id="site-name"><strong> <a href="<?php print $front_page; ?>" title="<?
  • 42.
  • 43.
    <div id="<?php print$block_html_id; ?>" class="<?php print $classes; ?>"<?php print $attributes; ?>> <?php print render($title_prefix); ?> <?php if ($block->subject): ?> <h2<?php print $title_attributes; ?>><?php print $block- >subject ?></h2> <?php endif;?> <?php print render($title_suffix); ?> <div class="content"<?php print $content_attributes; ?>> <?php print $content ?> </div> </div>
  • 44.
  • 45.
  • 47.
    /** *Implements hook_ctools_plugin_api(). */ function ce_panels_ctools_plugin_api($module, $api) { if ($module == 'panels' && $api == 'styles') { return array('version' => 2.0); } if ($module == 'page_manager' && $api == 'pages_default') { return array('version' => 1); } if ($module == "panels_mini" && $api == "panels_default") { return array("version" => "1"); } } /** * Implements hook_ctools_plugin_directory() */ function ce_panels_ctools_plugin_directory($module, $plugin) { if ($module == 'page_manager' || $module == 'panels' || $module == 'ctools') { return $plugin; } }
  • 48.
    <?php /** * @file * Layout definition for Code Enigma one column layout. */ /** * Panel layout definition. */ $plugin = array( 'title' => t('Code Enigma One Column'), 'category' => t('Code Enigma'), 'icon' => 'ce_one_column.png', 'theme' => 'ce_one_column', 'regions' => array( 'content' => t('Content'), ), );
  • 49.
    <?php /** * @file * Layout template for Code Enigma one column layout. * * Regions: * - content */ if (isset($content['content'])) { print $content['content']; }
  • 50.
    a method forturning of all supplied CSS and JS
  • 51.
  • 52.
  • 53.
    display suite semanticviews panels panels everywhere semantic panels* *using a forked version atm
  • 57.
  • 58.
    <div class="field field-name-field-imagefield-type-image field-label-hidden"> <div class="field-items"> <div resource="/files/my_image.jpg" rel="og:image rdfs:seeAlso" class="field-item even"> <img width="120" height="289" alt="Aliquam bene" src="/files/my_image.jpg" typeof="foaf:Image"> </div> </div> </div>
  • 64.
  • 68.
  • 73.
  • 74.
    never write a.tpl.php
  • 75.
    never write a.tpl.php unless you really have to
  • 76.
    start by outputtingno markup at all
  • 77.
  • 78.
    think carefully aboutwhere you add your wrappers
  • 79.
  • 80.
  • 81.
    make things easyfor site builders
  • 82.
  • 83.
    avoids the temptationto do things in the theme you shouldn't do
  • 85.
  • 86.
  • 87.
  • 89.
  • 90.