Create a Drupal theme
We will not focus on details here, but just have an overview of the two main methods to create a Drupal theme.
You can use a default Starterkit or your very own, to be reused between projects. The idea here is to not extend but just make a copy to start from so there is no need to worry if the source changes. It's still possible to track source changes.
Create it in the
php core/scripts/drupal generate-theme my_theme --path themes/custom
php core/scripts/drupal generate-theme --starterkit source_theme_name my_theme
Starterkit theme (opens in a new tab) - Drupal.org
You take most of the base theme and add your own customizations. Sub-themes inherit all the features of the base theme, the base can also inherit from another base theme.
my_theme.info.yml file, use the following line and replace the
base theme: base_theme_name
Creating sub-themes (opens in a new tab) - Drupal.org
If Tailwind is your thing, make sure to read this fantastic post from Matt Glaman: Migrating to TailwindCSS, iteratively, in your Drupal theme (opens in a new tab) where he explains how to use TailwindCSS (opens in a new tab) with PostCSS and browserSync. Bundling and purging are handled by Laravel Mix (opens in a new tab), that removes the hassle of configuring Webpack.
You can fully override (replace with your own), remove (not load) or extend (add some files) to an existing library.
Pitfall: this needs to be done in
my_theme.info.yml and not in
Theming Drupal (opens in a new tab) - Drupal.org