Extending your Drupal 8 install profile with Drush Make

0 min read

Leah Wagner

In the previous post, Getting your install profile ready for Drupal, I introduced the file and syntax changes you will see as you migrate your install profile from Drupal 7 to Drupal 8. I also covered how Drupal 8’s new configuration management system gives you a whole new set of tools to work with. Having a profile in place helps get Drupal installed with the configuration settings that are most efficient for you. That’s a great first step but with this approach, you only have access to what is available in Drupal core. What about all those contributed modules you’ve come to depend on?

As I mentioned in my previous post, there are two ways you can approach this. Here I am going to explore the Drush Make approach.

What’s Changed for Drupal 8?

Honestly, not too much.



D7: PROFILE.build

; API ; -------- api = 2 ; Core ; -------- core = 7.x ; Includes ; -------- ; Define the latest version of Drupal. projects[drupal][version] = 7.50 ; Profile ; -------- ; Pull in install profile. projects[thejibe][type] = "profile" projects[thejibe][download][type] = "git" projects[thejibe][download][url] = "[email protected]:thejibe/the-jibe-profile-starter-kit.git" projects[thejibe][download][branch] = "d7-profile" ,

D8: PROFILE.build

# API # -------- api: 2 # Core # -------- core: 8.x # Projects # -------- projects: # Get the latest version of Drupal. drupal: # Picks the latest release. version: ~ # Pull in install profile. thejibeprofilestarterkit: type: "profile" subdir: "" download: type: "git" url: "[email protected]:thejibe/the-jibe-profile-starter-kit.git" branch: "d8-profile" ,

As you can see, I’m now using the .yml format for the D8 build file. Also, a big bonus is you no longer have to define the latest version of Drupal. Defining the version as version: ~ will pull in the most recent stable release. This was always a bit of a pain with the D7 build file. Before building a new project, you would have to update this version number.


New to Drush make files?

For those of you new to Drush make files, you would place this file within your desired directory on your webserver. You would then run $ drush make PROFILE.build. This will pull in the latest version of Drupal core and also pull in the profile from the git repo I am referencing.



Now you can pull in your favourite modules and themes.


D8: PROFILE-contrib.make

# API # -------- api: 2 # Core # -------- core: 8.x # Projects # -------- # Specify common subdir of "contrib" defaults: projects: subdir: "contrib" version: ~ projects: # Contrib admin_toolbar: version: ~ ctools: version: ~ devel: version: ~ google_analytics: version: ~ metatag: version: ~ pathauto: version: ~ token: version: ~ # Themes basic: type: "theme" subdir: "" # Specify a version version: "1.x-dev" ,

Before this works, you’ll also need to reference this file in the our build file.


D8: PROFILE.build (partial code snippet)

# API # -------- api: 2 # Core # -------- core: 8.x … # Includes # -------- includes: - PROFILE-contrib.make ,

Why keep contrib separate?

You can actually continue to define your contrib projects in your original PROFILE.build file. So what is the benefit of keeping this separate? You can take this approach when you want to create multiple PROFILE-TYPE-contrib.make files that can have different configurations. This allows everything in PROFILE.build to remains static. For example, you would create an alternative PROFILE-ecommerce-contrib.make file that could be used when if you kick off a new eCommerce store built with Drupal Commerce. The modules you need for that type of project are very different and thus warrant a different contrib make file.


Build it and they will come

So now that all of your files are ready, how do you kick things off? You’ll store your install profile in a git repo. Your repo has one branch for the install profile d8-profile and one for the make files d8-make. With that in place, here is how you would get things started.

Clone your repo to your webserver directory. $ git clone [email protected]:thejibe/the-jibe-profile-starter-kit.git yoursitename Checkout the make file branch. $ git checkout d8-make Run the Drush make file. $ drush make thejibeprofilestarterkit.build Optional: Rename all instances of thejibeprofilestarterkit to yourprofilename. Proceed to install Drupal select The Jibe Profile Starter Kit install profile. ,

Take it for a spin…

Want something tangible to work with? We have create a public repo with a profile starter kit. Take it for a spin and let us know what you think.


What to read next

Getting Your Install Profile Ready For Drupal 8