In this blog post, we'll guide you through the process of installing a Drupal theme from a GitHub repository using Composer. We'll be using the Gesso theme as an example, which can be found at https://github.com/forumone/gesso.
To install the theme from GitHub, you'll need to edit your project's composer.json file by adding a new custom repository. Insert the following code block:
{
"type": "package",
"package": {
"name": "forumone/gesso",
"version": "2.0",
"type":"drupal-theme",
"source": {
"url": "https://github.com/forumone/gesso.git",
"type": "git",
"reference": "8.x-2.x"
}
}
}
Add the code block after the following section in your composer.json file:
{
"type": "composer",
"url": "https://packages.drupal.org/8"
},
Next, run the following command to download the theme and update composer.lock:
composer require "forumone/gesso"
Although installing the theme from GitHub is an option, it is important to note that the theme is also hosted on drupal.org. In most cases, you can simply install the theme using the following command:
composer require drupal/gesso
This method is recommended, as it ensures that you are installing a stable release of the theme.