Using Core Base Themes in Drupal 8

One of the first questions I get asked when teaching a Drupal theming class is which base theme to use. The answer has always starts with the unsatisfying: "It depends". Now that I'm teaching Drupal 8 theming, we have a couple new base themes in core added to the mix: classy and stable.

You can learn the difference between the two and how to use them in this previous post.

For those without a strong preference for a base theme, starting out with Classy is a great option. You get a lot of great theming features out-of-the-box with Drupal core:

  • Normalize.css and modernizr.js in core
  • Cleaner, more accessible markup
  • HTML5 tags
  • Templates easily located in core themes
  • More consistent classes for HTML components

So skipping the contrib base theme and extending Classy is a good choice. You get some good defaults, and then you get to define in your theme:

  • Which regions you want
  • The layout (either a custom one, or by adding a pre-defined grid CSS)
  • The structure of your own CSS or SASS files
  • The extra classes you need to add to implement the design

This approach has lots of advantages:

  • Drupal 8 core is awesome
  • You get understanding, control over what’s added in your theme
  • You're adding fewer customizations that you aren't aware of
  • There's less code to maintain
  • It's easier to on-board new themers

Using a contrib theme like Bootstrap is a great option if you're working with a team that's familiar with Bootstrap, and you want to make it super easy for them to keep doing what they're doing. Or, if you need a lot of layout options and want the ease of working with a pre-existing grid system. Using the Bootstrap theme, as opposed to adding the grid CSS directly to your custom theme also allows you to take advantage of the many theme settings it provides.

Otherwise, if you're creating a new theme for Drupal 8, it's a great opportunity to give the Classy theme a try!

Here are the slides from my talk on this topic at Drupal North. You can also check out the follow-up webinar I'm doing on creating layouts for Drupal 8 on Monday, June 27th at noon.