Steps of creating Drupal theme
Introduction
A theme is a collection of files that implements the look of the site. They simply implement the HTML, the CSS, and JavaScript that will be making our site unique. They also consist of a bit of simple logic that is used to make our website reuse or switch markup in different cases.
STEP 1
First, we need to create a custom theme under the ‘web/themes/custom folder. We will name the folder as vetenary (say). You can put any name but in my case, I take it vetenary .
STEP 2
Next, we will need to create an info.yml file. We need to specify the primary keys for it.
STEP 3
We have to make CSS and JS folder under which we have to place all our CSS and JS files.
STEP 4
In step 3, we have to create a libraries.yml file to specify all the libraries we need for our custom theme. We will also create CSS and JS directory and its files to link it here.
Note: We have to give 2 spaces before the version, CSS and js, and 4 spaces before the theme.
STEP 5
After creating the libraries.yml file, we need to link it to our theme. For this, we will add it to the info.yml file which will then apply to the whole theme.
Note – The key will be libraries and the rule for defining the path of the theme – ‘vetenary’ / library name -‘global-styling’.
STEP 6
In this step, we will define the regions for our theme. In info.yml, we have to define it under the ‘regions’ key.
STEP 7
Now we have to create a folder name as a template under which we have to place our twig files.
Inside the template folder, we have to override our page.html.twig.
STEP 8
Now Go to Appearance in your Drupal site. You can see your custom Drupal theme present in the Uninstalled themes section. You need to click the ‘Install and set as the default option to install your Drupal theme on the site.
Additional information
If you want to apply the screenshot to your theme, then you have to put a .png file inside your theme folder, and also want to apply the logo to your custom theme, then you have to put a logo.png file inside the theme folder.