I've published another article on the Lullabot site! This time around the topic is Drupal 8 Theming Fundamentals. This is part one in a two-part series that will help folks get up to speed on all the changes in Drupal 8 theming.
At the conclusion of the series there will be a starter theme made available on GitHub. Although not discussed in the posts, this starter theme will also include a basic Gulp workflow to make it as easy as possible to get started.
In the post on base themes that I wrote earlier this week, I pointed out that core adds a lot of CSS to your site that you may not want. If you find yourself overriding this CSS in your themes, you definitely have some bloat that you could trim down.
You also run into this issue quite a bit with contributed modules. Views, Flexslider and Superfish are modules that typically add a lot of CSS I don't want. So how to get rid of this potentially unwanted code?
Adding stylesheets to a web page is one of the first things a designer or developer learns how to do, but adding a stylesheet the "Drupal way" calls for a different approach. In my rush to finish the custom theme for my first Drupal site, I skipped the documentation on adding CSS and simply placed a link to the stylesheet in the page.tpl.php template file.
It's a little embarrassing to admit this mistake now, but it wasn't such a bad guess, really. After all, adding styles to a template file is the preferred method in other flavors of web development. But by adding my CSS in this way, I bypassed Drupal's stylesheet aggregation and compression, and in doing so, lost a nice little performance boost