In praise of Drupal 8’s new file structure

There is a lot of excitement in the Drupal world right now around Drupal 8 – and for good reason. There are some huge advances being made on the project – Views in Core! A new template engine! Symfony! Mobile administration! Config management! The list goes on.

However, today, I wanted to praise something that may not really get mentioned a lot, but I think will be appreciated by almost everyone who builds Drupal sites (ESPECIALLY those new to Drupal): the file structure!

Here is what it looks like currently in Drupal 7, when downloaded:

Drupal 7 Default File Structure

And here is what it looks like in Drupal 8 (as of the writing of this post):

Drupal 8 File Structure - yay!

And for the truly hardcore, you can prune the files down yourself to:

Drupal 8 File Structure - Hardcore edition

(Assuming you don’t want to keep profiles around after installation)

This isn’t to say a lot of the stuff in D7 has gone away – it’s just been neatly wrapped in the “core” directory. Guess what folder you should never mess with? “core”. That’s it. My guess is that if you need to do a Drupal core update, it will simply be a matter of replacing the /core folder, and running an update script.

Guess what else is new? If you’re building a theme for your site, where would you think it should go? How about the /themes folder! What if you need to add a module? Why, put it in the /modules folder!

This will be a semi-revolution for longtime Drupal users. In D7 and before, themes would go in sites > all > themes, and modules would go in sites > all > modules. Not the hardest concept to wrap one’s head around, but the new way is a lot more straightforward. I think someone new to Drupal will also appreciate the intuitive file structure a lot.

Long time Drupal users will then say “but what about multisite”? I don’t know for sure, but my intuition tells me that themes and modules that are placed in /themes and /modules will be available to all sites. They essentially replace sites > all. However, site-specific themes can be placed in the /sites/ directory.

Drupal folks, let’s be real: 99.9% of any work in Drupal 7 and before was done in sites > all. It only makes sense that those files would be at the root of a Drupal site.

So, I’m stoked about the new Drupal file structure. It’ll be one of many, many new things to look forward to in Drupal 8. Maybe, just maybe, another CMS out there might be able to follow Drupal’s lead:

wp-what?