How to Create a Drupal 8 Bootstrap Subtheme

| Drupal
Create a Drupal 8 Bootstrap subtheme using CDN

Bootstrap is an incredibly popular option for creating Drupal themes.

Using the Bootstrap CDN allows you to quickly and flexibly add custom code that overrides the Bootstrap defaults. This is a great way to make your own Drupal theme based on Bootstrap.

In this tutorial, we will demonstrate how to create a Drupal 8 subtheme that uses the Bootstrap CDN.

  • Firstly, you will need to download, install and enable the Bootstrap theme.
  • Now open the Bootstrap folder, enter the starterkits folder and copy the CDN folder.
  • Place the /cdn/ folder in the main /themes/ folder next to /bootstrap/:

001

  • Now rename the /cdn/ folder with the name you want to give your theme. For this tutorial, I will simply call it /subtheme/.
  • Now we need to replace THEMENAME with subtheme in the following files:
    • /config/install/THEMENAME.settings.yml
    • /config/schema/THEMENAME.schema.yml
    • /THEMENAME.libraries.yml
    • /THEMENAME.theme
  • The starterkit file is slightly different and needs to be renamed from /THEMENAME.starterkit.yml to /subtheme.info.yml
  • Now open subtheme/subtheme.info.yml in your editor of choice. I recommend Atom.
  • Again update the 'THEMETITLE' and description with the details of your theme.

002

  • Now open the schema file inside config and update the label

003

  • Now go back to the "Appearance" tab in your Drupal site.
  • Scroll down to the uninstalled themes section and we should see "subtheme".

004

Install and set as the default theme and you are ready to start customising your own theme.


About the author

Daniel is a web designer from UK, who's a friendly and helpful part of the support team here at OSTraining.