Introduction

Holy is a Drupal starter theme. It styles a standard Drupal installation out of the box and is meant to be the starting point of your own project theme: you clone it, give it a new name and change it as you like. The theme follows the principles of atomic design, ships a set of Single Directory Components and comes with a modern frontend toolchain (Sass, Vite, Tailwind CSS, linters) and a GitLab CI pipeline.

This guide is written for developers who know the web technologies (HTML, CSS, Sass, JavaScript, PHP, Node.js) but have not worked with Drupal much. Drupal specific terms are explained in Drupal basics for newcomers and in the Glossary.

Property Value
Machine name holy
Drupal core 11.3 or newer, 12 (core_version_requirement: ^11.3 || ^12)
Base theme none (base theme: false), Holy is a standalone theme generated from core's Starterkit
Composer package drupal/holy
Project page https://www.drupal.org/project/holy
Source code https://git.drupalcode.org/project/holy
Node.js (development only) 20.19 or newer, 22 recommended (.nvmrc)
License GPL-2.0-or-later

Drupal basics for newcomers

A short overview of how Drupal renders a page and where a theme fits in. Details are in the official Theming Drupal guide.

Technologies

Overview of everything the theme uses, grouped by purpose. Versions of the Node.js tools are pinned in package.json and package-lock.json.

Drupal

Technology Used for Documentation
Drupal theming Theme definition, regions, libraries, template overrides. Theming Drupal
Defining a theme with an .info.yml file
Adding assets via *.libraries.yml
Twig All HTML templates (templates/, components/). Twig documentation
Twig in Drupal
Single Directory Components Reusable components in components/. Using Single Directory Components
Starterkit theme Holy was originally generated from core's Starterkit. It does not depend on Starterkit: the styles of the former Starterkit libraries (files, progress bar, node, indented comments, search results) are in the theme's own Sass. Starterkit theme
JavaScript API Drupal.behaviors and once() in js/ and component scripts. JavaScript API overview
Drupal coding standards PHP, JavaScript, CSS and Twig conventions enforced by the linters. Drupal coding standards

Styles

Technology Used for Documentation
Sass (SCSS) All theme and component styles. Compiled by sass-embedded (Dart Sass), the module system @use / meta.load-css is used, no @import. Sass documentation
Atomic design Organization of the Sass sources into base, atoms, molecules, organisms, templates and pages. Atomic Web Design
CSS cascade layers Each atomic level is a @layer, so a later level wins regardless of selector specificity. MDN: @layer
CSS container queries Content in the main column and the sidebars adapts to the width of its column, not the viewport (@container). Query containers: .site-main (main), sidebars (sidebar), the comments section, pager and local tasks. Breakpoints $container-* (480, 640, 800px). Page chrome (navbar, header, menu, footer, page grid) keeps @media. MDN: Container queries
CSS custom properties Colors and breakpoints from sass/_variables.scss are exposed as --primary, --gray-50... in css/root.css. MDN: Using CSS custom properties
BEM Class naming in templates (.comment__author, .main-menu__link--level-2). getbem.com
Tailwind CSS 4 Utility classes prefixed with tw: (tw:text-center), generated only for classes used in templates/ and components/. Tailwind CSS documentation
PostCSS Post-processing of the compiled CSS. postcss.org
postcss-pxtorem Converts px to rem (1rem = 16px), except in media queries. github.com/cuth/postcss-pxtorem
Autoprefixer Adds vendor prefixes based on Browserslist defaults. github.com/postcss/autoprefixer
postcss-sorting Sorts declarations into a fixed property order (position, display, box model, typography...). github.com/hudochenkov/postcss-sorting
Web fonts Self-hosted Nunito Sans and Geologica (WOFF2, Latin and Cyrillic subsets) in fonts/, declared in sass/fonts.scss. MDN: @font-face

Build and tooling

Technology Used for Documentation
Node.js and npm Runs the frontend tools. Only needed for development, a production server does not need Node.js because the compiled CSS is committed. nodejs.org
npm docs
nvm Optional Node.js version manager, reads .nvmrc. github.com/nvm-sh/nvm
Vite Build tool: compiles Sass and Tailwind to CSS, watch mode. vite.dev
BrowserSync Used by npm run watch: proxies the Drupal site, injects rebuilt CSS and reloads the page after a template or script change. browsersync.io
fast-glob Finds Sass entry files and expands folder imports in the Vite config. github.com/mrmlnc/fast-glob
Composer Installs the theme and the PHP tools (Coder, PHPStan) in the Drupal project. getcomposer.org
Drush Drupal command line: cache rebuild, enabling the theme. drush.org
DDEV Recommended local environment (Docker). All commands can be run inside it. ddev.com

Code quality

Technology Used for Documentation
Stylelint SCSS linting, rules based on Drupal core plus limits for nesting and selector length. stylelint.io
ESLint JavaScript linting following the Drupal JavaScript coding standards. eslint.org
Prettier Formatting of SCSS, JavaScript and the generated CSS. prettier.io
CSpell Spell check (US English) of code, comments and templates. cspell.org
PHP_CodeSniffer + Drupal Coder PHP coding standards (Drupal, DrupalPractice). PHP_CodeSniffer
drupal.org/project/coder
PHPStan Static analysis of PHP, level 5. phpstan.org
GitLab CI (drupal.org templates) Automated checks for every push and merge request on drupal.org. GitLab CI templates
EditorConfig Shared editor settings (2 spaces, LF, UTF-8). editorconfig.org

Theme structure

holy/
├── holy.info.yml          theme definition, regions
├── holy.libraries.yml     CSS/JS libraries
├── src/Hook/              PHP hooks as classes (preprocess, suggestions, settings form)
├── src/ThemeCloner.php    the Clone theme tool
├── config/optional/       default block placements
├── config/schema/         configuration schema of the theme settings
├── templates/             Twig template overrides
│   ├── block/  content/  content-edit/  dataset/  field/  form/
│   └── layout/  misc/  navigation/  user/  views/
├── components/            Single Directory Components
│   └── <component>/
│       ├── <component>.component.yml
│       ├── <component>.twig
│       ├── <component>.css     generated from sass/
│       ├── <component>.js      optional
│       ├── sass/               component Sass sources
│       ├── templates/          optional Drupal template overrides
│       └── images/             optional
├── sass/                  Sass sources (atomic design)
│   ├── _variables.scss
│   ├── base/  atoms/  molecules/  organisms/  templates/  pages/
│   ├── base.scss  templates.scss  atoms.scss  molecules.scss
│   ├── organisms.scss  pages.scss  root.scss  fonts.scss  ckeditor.scss
│   └── tailwind.css
├── css/                   compiled CSS (generated, committed)
├── js/                    theme JavaScript (Drupal behaviors)
├── fonts/                 self-hosted WOFF2 fonts
├── images/                icons and images used in CSS
├── scripts/               helper scripts for npm
├── tests/                 PHPUnit tests (Functional, Unit)
├── doc/                   this documentation
└── package.json, vite.config.js, ... frontend tooling

Regions

Regions are declared in holy.info.yml and printed in templates/layout/page.html.twig. Empty regions are not rendered.

Machine name Label Placement in the page
navbarNavbarMobile top bar with the hamburger button (.site-navbar).
headerHeaderHeader, usually the site branding (.site-header).
header_menuHeader menuHeader, e.g. language switcher and user account menu.
header_searchHeader searchHeader, search form.
menuMenuMain navigation bar (.site-menu).
breadcrumbBreadcrumbHidden on the front page.
titleTitlePage title inside main, hidden on the front page.
contentContentMain content (.site-main).
sidebar_firstPrimary sidebarLeft sidebar (.site-sidebar-first).
sidebar_secondSecondary sidebarRight sidebar (.site-sidebar-second).
footerFooter.site-footer
copyrightCopyrightBottom bar (.site-copyright).

The center wrapper gets one of the classes no-sidebars, one-sidebar sidebar-first, one-sidebar sidebar-second or two-sidebars, depending on which sidebars have content.

A menu block that renders no items on the current page (e.g. the sidebar menu on a page without a submenu) is removed in preprocess_page, and so is a region left without blocks. Without this, the region would not be empty in page.html.twig (blocks are rendered later through placeholders) and an empty sidebar would take a column.

Sidebar menu. The block holy_sidebar_menu shows the main menu from the second level in the sidebar_first region, so it appears only in sections with a submenu. Its heading is the first-level item of the current section, linked to the section page (any menu block starting below the first level with a visible label gets this heading). It uses the core menu block, no contrib module is needed. Styles: sass/organisms/sidebar/_sidebar-menu.scss.

Language switcher. On a multilingual site (Language module with at least two languages) the block holy_languageswitcher shows the interface language switcher in the header_menu region, before the user account menu. Links show the language code (EN, CS); screen readers get the language name in the language itself (preprocess_links__language_block). Styles: sass/organisms/header/_header-language.scss.

About Holy block. The block holy_about shows a short description of the theme with links to the project page, issue queue, source code and demo site, only on the front page, in the sidebar_second region. A theme cannot provide a block plugin and a custom block (block_content) is content, not configuration, so the text lives in the header of the view views.view.holy_about, which lists no rows. Edit the text in Views (/admin/structure/views/view/holy_about), translate it with Configuration translation. Styles: sass/organisms/block/_block-holy-about.scss.

Templates

templates/ contains overrides of core templates, grouped into folders the same way as in core's Starterkit. The folder names are only for orientation, Drupal finds a template by its file name anywhere inside the theme.

Folder Content
layout/html.html.twig (the HTML document), page.html.twig (page layout and regions), region.html.twig, maintenance-page.html.twig.
block/Block wrappers: branding, menus, search form, local tasks and actions.
content/Nodes (full, teaser), comments, taxonomy terms, page title, search results.
content-edit/Content editing forms: node edit form, file and image widgets, text format help.
dataset/Tables and item lists.
field/Field wrappers and formatters (image, file, link, time, text).
form/Form elements: input, select, textarea, checkboxes, radios, fieldset, details...
navigation/Menus, breadcrumb, pager, local tasks (tabs), vertical tabs. menu--main--menu.html.twig renders the main menu in the menu region with the main_menu component.
misc/Status messages, progress bar.
user/User profile and user name.
views/Views output: unformatted list, grid, table, exposed filters, mini pager.

Finding the right template

Turn on Twig development mode at /admin/config/development/settings (local environment only). Drupal then prints HTML comments with the template used for every part of the page and the list of possible file names (suggestions), and it stops caching templates. To override a template, copy it from core (e.g. web/core/modules/node/templates/node.html.twig) or from Starterkit (web/core/themes/starterkit_theme/templates/) into templates/, rename it to the suggestion you need and run drush cr.

Holy adds one suggestion of its own: menus placed as blocks get a suggestion with the region name, menu--<menu>--<region>.html.twig (implemented in src/Hook/ThemeHooks.php). This is why menu--main--menu.html.twig applies only to the main menu in the menu region, while the same menu in the footer uses the default menu.html.twig.

Components

Each folder in components/ is a Single Directory Component. Its ID is holy:<file name of the .component.yml>, e.g. holy:main_menu. Drupal attaches <name>.css and <name>.js from the component folder automatically; extra dependencies are declared under libraryOverrides. A component is rendered from Twig with:

{{ include('holy:main_menu', { items: items, attributes: attributes }, with_context = false) }}

A component can also contain a templates/ folder with Drupal template overrides that map Drupal data (a node, a view) to the props and slots of the component, so everything that belongs to one feature stays in one folder.

Component Group Description
main_menuNavigationMain navigation: dropdowns on hover and focus on desktop, collapsible submenus on mobile.

Sass structure

Styles follow atomic design. Every level has its own entry file, compiles into its own CSS file and is a cascade layer. The order of the layers is declared once in sass/base.scss:

@layer base, atoms, molecules, organisms, templates, pages;

templates only places the regions (.site-*, .region-*, .layout) with layout properties (display, grid, order, width, gap, padding, container...) and never styles what is inside them, so it does not override the components. The .container is an atom, so organisms can change its padding.

Source Content Output
sass/_variables.scssSass variables: colors, screen and container breakpoints. No CSS output.-
sass/root.scssVariables exposed as CSS custom properties on :root.css/root.css
sass/fonts.scss@font-face declarations.css/fonts.css
sass/base/Reset, html, body.css/base.css
sass/atoms/Typography, media, form elements, buttons, icons, container.css/atoms.css
sass/molecules/Breadcrumb, tabs, pager, form items, fields, messages, details...css/molecules.css
sass/organisms/Regions (header, navbar, footer, sidebar), node, comment, blocks, views, dialogs.css/organisms.css
sass/templates/Page layout: columns, sidebars.css/templates.css
sass/pages/Page specific styles (search, user login, registration, password reset).css/pages.css
sass/ckeditor.scssTypography inside the CKEditor 5 editing area.css/ckeditor.css
sass/tailwind.cssTailwind CSS entry: tw: prefix, sources to scan, theme colors and breakpoints.css/tailwind.css
components/*/sass/Component styles.components/*/*.css

How the cascade works in Holy:

Conventions for Sass files:

Tailwind CSS

Tailwind is used only as a utility layer next to the Sass styles:

{# Tailwind only generates classes written out in full, keep these maps literal. #}
{% set aligns = {
  left: 'tw:text-left',
  center: 'tw:text-center',
  right: 'tw:text-right',
} %}
<div class="text {{ aligns[text_align] ?? '' }}">...</div>

After adding or removing a tw: class in Twig run npm run build (or keep npm run dev running), otherwise the class is missing in css/tailwind.css.

Libraries

Defined in holy.libraries.yml:

Library Content Attached
holy/global-stylingAll files from css/ (in the order fonts, root, base, atoms, molecules, organisms, templates, pages, tailwind) and js/navbar.js.On every page (holy.info.yml).

The keys base, layout, component and theme in the library definition are Drupal's CSS groups (based on SMACSS); Drupal outputs them in this order. css/ckeditor.css is loaded into the CKEditor 5 editing area through ckeditor5-stylesheets in holy.info.yml, so editors see content styled like on the website.

JavaScript

Theme scripts are plain JavaScript without a build step, written as Drupal behaviors:

/**
 * @file
 * Support for navbar-collapse with navbar icon-menu.
 */

((Drupal, once) => {
  Drupal.behaviors.navbarCollapse = {
    attach(context) {
      once('navbarCollapse', '.icon-menu', context).forEach((iconMenu) => {
        iconMenu.addEventListener('click', () => {
          const open = document.body.classList.toggle('menu-open');
          iconMenu.setAttribute('aria-expanded', open ? 'true' : 'false');
        });
      });
    },
  };
})(Drupal, once);

js/navbar.js opens and closes the mobile menu. Component scripts (main_menu.js) live in their component folders. Every file starts with a @file docblock (required by ESLint).

Default configuration

config/optional/ contains block placements (block.block.holy_*.yml) that Drupal imports when the theme is installed: branding in the navbar, header and footer, main menu, sidebar menu (main menu from the second level), language switcher, the About Holy block on the front page (with its view views.view.holy_about), footer menu, user account menu, search form, breadcrumb, page title, messages, help, local tasks, main content and "Powered by Drupal". Configuration in optional (unlike install) is imported only if its dependencies exist, e.g. the language switcher needs the Language module, and the search block: Drupal 12 removed the Search module from core, it is available as a contrib module. After installation the blocks are regular configuration and can be changed at /admin/structure/block.

Root files

Files in the root folder of the theme.

Drupal files

File / folder Purpose
holy.info.ymlTheme definition, required by Drupal: name, description, supported core versions, base theme (none), regions, global libraries and the CKEditor 5 stylesheet. Changes need drush cr; adding or removing regions moves blocks, so check the block layout afterwards.
holy.breakpoints.ymlBreakpoints for responsive image styles: holy.mobile, holy.md (850px), holy.lg (1360px), multipliers 1x, 1.5x, 2x.
holy.libraries.ymlAsset libraries (CSS and JS), see Libraries.
src/Hook/ThemeHooks.phpHooks as a class (Drupal\holy\Hook\ThemeHooks, registered automatically as a service): preprocess_page removes menu blocks without items (and regions left empty), preprocess_block and theme_suggestions_menu_alter add the per region menu suggestions and the section heading of menu blocks starting below the first level, preprocess_links__language_block shortens the language switcher links to language codes, preprocess_image_widget hides the image preview for users without access. Replaces the former holy.theme file. See Hooks in themes can now be OOP.
src/Hook/ThemeSettingsHooks.phpImplements form_system_theme_settings_alter: adds the Clone theme tool to the theme settings form (/admin/appearance/settings/holy), with its validate and submit handlers. Replaces the former theme-settings.php.
src/ThemeCloner.phpCopies the theme and replaces its name, used by the Clone theme tool.
config/schema/holy.schema.ymlConfiguration schema of the theme settings (holy.settings). Drupal validates saved configuration against it, without it saving the settings fails in tests.
logo.svgDefault site logo, used by the branding block unless a custom logo is uploaded in the theme settings.
screenshot.pngTheme preview on the Appearance page.
composer.jsonComposer package definition: drupal/holy, type drupal-theme, so Composer installs it to web/themes/contrib/holy.
LICENSE.txtGNU GPL version 2 or later, the license of all Drupal projects.
README.mdShort reference for developers.
CHANGELOG.mdNotable changes per release, breaking changes first.
AGENTS.mdInstructions for AI coding agents: English only in the source, commands, workflow rules.

Frontend tooling

File Purpose
package.jsonnpm scripts (dev, build, lint, fix, spellcheck...), required Node.js version (engines) and the development dependencies.
package-lock.jsonExact versions of all dependencies. Commit it, install with npm ci to get the same versions everywhere.
.nvmrcRecommended Node.js major version (22) for nvm use and the CI image.
.npmrcengine-strict=true: npm refuses to install with an unsupported Node.js version.
vite.config.jsBuild configuration, see Build pipeline.
postcss.config.jsPostCSS plugins: px to rem, Autoprefixer, property sorting (with the full property order).
stylelint.config.jsSCSS lint rules: stylelint-config-standard-scss plus rules taken over from Drupal core, allowed units, no IDs, nesting and selector limits, property order check.
eslint.config.jsESLint flat config: recommended rules, Drupal JavaScript coding standards, browser and Drupal globals (Drupal, drupalSettings, once), required @file docblock, Node.js globals for config files.
.prettierrc.jsonPrettier options: 80 characters, single quotes, trailing commas for JS; long lines and double quotes for CSS/SCSS.
.prettierignoreFiles Prettier does not check: node_modules/, generated CSS, package-lock.json, the script of the documentation template.
scripts/check-node.cjsRuns before the npm scripts (pre* hooks) and stops with a readable message when Node.js is older than 20.19.

Code quality and CI

File Purpose
phpcs.xml.distPHP_CodeSniffer rules: Drupal and DrupalPractice standards for PHP and YAML files.
phpstan.neonPHPStan configuration: level 5, scans the PHP files (src/, tests/).
.cspell.jsonSpell check configuration (US English, ignored paths, flagged words). Used by drupal.org CI.
scripts/cspell.local.jsonLocal spell check: .cspell.json plus the Drupal core dictionaries, the same setup as in CI.
.cspell-project-words.txtProject specific words accepted by the spell check, one per line.
tests/PHPUnit tests, see Tests.
.gitlab-ci.ymlGitLab CI pipeline on drupal.org, see Continuous integration.
.editorconfigEditor settings: UTF-8, LF, 2 spaces, final newline, no trailing whitespace (4 spaces for composer.json).
.gitignoreExcludes node_modules/ from git.
.vscode/Recommended VS Code extensions (EditorConfig, ESLint, Stylelint, Prettier, PHP CodeSniffer) and workspace settings matching the coding standards.

Installation

Requirements

Download the theme

Download the theme with Composer from the root of your Drupal project (the folder with composer.json and vendor/):

composer require drupal/holy

The theme is placed in web/themes/contrib/holy. With DDEV prefix the commands with ddev:

ddev composer require drupal/holy

Enable the theme

In the administration go to Appearance (/admin/appearance), find Holy and click Install and set as default. Or with Drush:

drush theme:enable holy
drush config:set system.theme default holy -y
drush cr

On installation Drupal imports the block placements from config/optional/. Check the result at Structure > Block layout (/admin/structure/block).

For a real project do not use Holy directly: create your own theme as a clone, so updates of Holy never overwrite your changes.

Set up the development tools

Needed only when you change styles or scripts. The compiled CSS is committed, so a production server needs neither Node.js nor a build.

cd web/themes/custom/CUSTOM_THEME
nvm install        # optional, installs the Node.js version from .nvmrc
npm ci             # installs the exact versions from package-lock.json
npm run build      # compiles all styles

If the Node.js on your computer is older than 20.19, run the commands inside DDEV (the DDEV web container has a current Node.js):

ddev exec -d /var/www/html/web/themes/custom/CUSTOM_THEME "npm ci"
ddev exec -d /var/www/html/web/themes/custom/CUSTOM_THEME "npm run build"

The PHP checks and tests (npm run lint:php, npm run test) need PHPUnit, Drupal Coder and PHPStan in the project's vendor/. All of them come with drupal/core-dev:

composer require --dev drupal/core-dev

Cloning the theme

The recommended way to create your own theme is to clone Holy from its settings page. The clone is a standalone theme, not a sub-theme: it does not depend on Holy, so Holy can be updated or even removed without affecting your site. You own all the code of the clone and change it freely.

Why a clone and not a sub-theme? A sub-theme inherits templates, libraries and styles from its base theme, so every update of the base theme can change your site. A starter theme like Holy is meant to be copied once and then developed on its own; this is also how Drupal core's Starterkit works.

Create a clone

  1. Go to Appearance > Settings > Holy (/admin/appearance/settings/holy).
  2. Open the Clone theme section at the end of the form.
  3. Fill in the Theme name (human-readable, e.g. My Project). The Machine name is generated from it (e.g. my_project) and can be edited: it must start with a letter and contain only lowercase letters, numbers and underscores, and it must not be used by another theme, module or profile. Optionally fill in the Description.
  4. Press Create clone. You are redirected to the Appearance page, where you install the new theme and set it as default.

The web server must be able to write into web/themes/custom. Clone the theme in your local environment and commit the result to your project repository, not on a production server.

If the Clone theme section is missing after deploying a new version of Holy, run drush cr.

What the clone does

The compiled CSS is copied as well, so the clone works immediately, without running a build. The clone keeps the Clone theme tool, so it can be cloned again.

After cloning

cd web/themes/custom/my_project
drush theme:enable my_project
drush config:set system.theme default my_project -y
npm ci
npm run build
git init   # or commit the folder to your project repository

Then adjust the clone to your project:

Alternative: core Starterkit generator

Drupal core can generate a theme from any theme marked as a starterkit with a command line tool. Holy does not need it (the clone tool does the same from the UI), but for completeness:

php web/core/scripts/drupal generate-theme my_project

Without --starterkit this generates a theme from core's starterkit_theme, not from Holy. See Starterkit theme.

Automation

All automation is driven by npm scripts in package.json. Run them from the theme folder.

npm scripts

Command What it does
npm ciInstalls the development dependencies exactly as in package-lock.json.
npm run buildOne-off build of all styles: sass/*.scss, sass/tailwind.css and components/*/sass/*.scss.
npm run devBuild and watch: rebuilds when a source file or a template with Tailwind classes changes.
npm run watchSame as npm run dev, plus browser reload: open the site at https://localhost:3000, see Browser reload.
npm run lintStylelint and Prettier check for SCSS, ESLint and Prettier check for JavaScript. Changes nothing.
npm run fixFixes what can be fixed automatically (Stylelint, ESLint) and formats the code with Prettier.
npm run lint:phpPHP_CodeSniffer (Drupal, DrupalPractice) and PHPStan, using the tools from the project's vendor/bin.
npm run fix:phpFixes PHP coding standard violations with phpcbf.
npm run spellcheckCSpell with the Drupal core dictionaries and the project words. Optional, for manual use: it is slow and drupal.org CI checks spelling.
npm run styleguideUpdates styleguide/index.html from the current state of the theme (run it after npm run build): the CSS links of the theme libraries and components, and the code samples marked with data-rwstyleguide-file. npm run styleguide -- --check only lists what is outdated.

Every script first runs scripts/check-node.cjs (npm's pre* hooks), so an old Node.js fails with a clear message instead of a cryptic error.

Build pipeline

vite.config.js uses Vite only as a CSS compiler, there is no JavaScript bundling and no Vite dev server. What happens on npm run build:

  1. Entry points. Every Sass file that does not start with _ is an entry:
    • sass/<name>.scss → css/<name>.css
    • components/<component>/sass/<name>.scss → components/<component>/<name>.css
    • sass/tailwind.css → css/tailwind.css
    A new entry file is picked up automatically.
  2. Folder imports. A small plugin expands @include meta.load-css("dir/**/*"); into one meta.load-css per partial, in alphabetical order.
  3. Sass compilation with sass-embedded.
  4. Tailwind (@tailwindcss/vite) scans templates/ and components/ and generates the used tw: utilities.
  5. PostCSS (postcss.config.js): px → rem, vendor prefixes, property sorting.
  6. Unchanged URLs. Drupal serves the CSS from fixed paths, so url() values must stay exactly as written. The config hides them from Vite's URL rewriting and restores them in the output; Vite does not copy any images or fonts.
  7. Readable output. The generated CSS is not minified and is formatted with Prettier, so diffs of the committed CSS are easy to review. Drupal minifies and aggregates CSS itself in production (/admin/config/development/performance).
  8. Clean output. Empty JavaScript chunks that Vite creates for CSS entries are removed.

The generated files (css/*.css, components/*/*.css) are committed to git. Never edit them by hand, change the sources and run the build.

Browser reload

npm run watch runs the same watch build as npm run dev and starts BrowserSync (a plugin in vite.config.js, active only in this mode):

Testing in several browsers and devices

Every browser or device that opens the site through BrowserSync is connected to the same npm run watch: all of them get the injected CSS and reload together. BrowserSync also mirrors interaction between them (ghost mode): clicks, scrolling, navigation and form input made in one browser are repeated in the others.

Several browsers on the same computer. Open https://localhost:3000 in each browser (Chrome, Firefox, Edge...) and accept the self-signed certificate once in each of them.

Other devices (phone, tablet, another computer) must be on the same network. When it starts, BrowserSync prints two addresses:

[holy] Access URLs:
       Local: https://localhost:3000
    External: https://192.168.1.20:3000

Open the External address on the device and accept the certificate warning (Chrome: Advanced → Proceed, Safari: Show Details → visit this website). The device does not need to resolve the *.ddev.site domain, BrowserSync rewrites the links to its own address. If the page does not load, allow incoming TCP port 3000 in the computer's firewall.

WSL 2 (Windows). In the default NAT networking the External address is the internal address of the WSL virtual machine (e.g. 172.19.x.x), which other devices cannot reach. Choose one of these:

Drupal caches. Other browsers and devices usually visit the site as an anonymous user, whose pages Drupal serves from the page cache. Besides Twig development mode, turn on Do not cache markup at /admin/config/development/settings, otherwise a template change shows up only after drush cr. Login sessions are not shared: log in on each device separately.

Debugging on a device. For the console and inspector of a mobile browser connect the device by USB: Chrome on Android via chrome://inspect on the computer, Safari on iOS via Develop menu of Safari on macOS (turn on Web Inspector in the iOS Safari settings). For a quick check of layouts use the device toolbar in the browser developer tools, but it does not replace a real device (touch, viewport height with browser bars, fonts, Safari rendering).

Linting and formatting

With the recommended VS Code extensions (.vscode/extensions.json) the editor shows the same errors while you type.

Tests

tests/ contains PHPUnit tests in the standard Drupal layout (namespace Drupal\Tests\holy):

The tests are smoke tests: they catch a theme that breaks on a new Drupal version (removed APIs, Twig or library changes, PHP errors), not visual changes. Run them with:

cd web/themes/custom/CUSTOM_THEME
npm run test

# or with DDEV, from anywhere in the project
ddev exec -d /var/www/html/web/themes/custom/CUSTOM_THEME "npm run test"

npm run test runs core's PHPUnit (vendor/bin/phpunit -c web/core tests). The functional test needs a database and the site URL in SIMPLETEST_DB and SIMPLETEST_BASE_URL; the script defaults to the DDEV values (mysql://db:db@db/db, http://localhost), set the variables to run it elsewhere. Test tables use their own prefix, so the site database is not touched.

Continuous integration

.gitlab-ci.yml runs on drupal.org GitLab for every push and merge request. It includes the Drupal Association GitLab templates, which install Drupal with the theme and run:

The next major variant is switched on (OPT_IN_TEST_NEXT_MAJOR, _AUTORUN_NEXT_MAJOR): on every push and merge request the tests also run against the development branch of Drupal 12 with its minimum PHP version, so incompatibilities show up before Drupal 12 is released or updated.

The template ESLint and Stylelint jobs are switched off (SKIP_ESLINT, SKIP_STYLELINT), because they use core's tool versions and cannot load the theme's own configs. They are replaced by the theme-assets job (Node.js 22), which:

  1. installs the dependencies (npm ci),
  2. runs npm run lint,
  3. runs npm run build,
  4. fails when the generated CSS differs from the committed CSS (git diff --exit-code -- css components). This catches commits where the sources were changed but the build was not run.

Development workflow

Everyday work

  1. Turn on Twig development mode and disable CSS aggregation locally (/admin/config/development/settings, /admin/config/development/performance).
  2. Run npm run dev (or npm run watch with browser reload) and edit the sources: sass/, components/*/sass/, sass/tailwind.css, templates.
  3. After changing .twig, .yml or PHP files run drush cr (not needed for Twig with development mode on, but needed for new templates, libraries, components and hooks).
  4. Before committing run npm run lint, after PHP changes npm run lint:php, after PHP, Twig or YAML changes npm run test, and npm run build.
  5. Commit the sources together with the generated CSS.

Add a Sass partial

  1. Create the file in the right atomic level, e.g. sass/molecules/_teaser-list.scss.
  2. Nothing else is needed, the entry file loads the whole folder and npm run dev picks up the new file.

Add a component

  1. Create components/my_component/ with my_component.component.yml (name, props, slots; use the $schema line from an existing component for editor validation) and my_component.twig.
  2. Put the styles into components/my_component/sass/my_component.scss; the build creates components/my_component/my_component.css, which Drupal attaches automatically.
  3. Optionally add my_component.js (a Drupal behavior) and dependencies under libraryOverrides.
  4. Run npm run build and drush cr, then use it: {{ include('holy:my_component', {...}, with_context = false) }}.

Override a template

  1. Find the template and its suggestions in the HTML comments (Twig development mode).
  2. Copy the original template into the matching folder in templates/ and rename it to the suggestion, e.g. node--article--full.html.twig.
  3. Run drush cr.

Add a region

  1. Add the region to regions in holy.info.yml. Listing regions replaces the default set, so keep all existing ones.
  2. Print it in templates/layout/page.html.twig ({{ page.my_region }}).
  3. Run drush cr and place blocks in the new region.

Troubleshooting

Problem Solution
A change in a template, YAML or PHP file has no effect.Run drush cr. For templates enable Twig development mode.
A change in Sass has no effect.Check that npm run dev is running and the CSS was regenerated; disable CSS aggregation or clear caches; reload without browser cache.
npm run watch does not reload the page.Open the site through https://localhost:3000, not its own URL. If the site URL cannot be detected, set BROWSERSYNC_PROXY.
A new entry file (sass/*.scss without an underscore, components/*/sass/*.scss) is not compiled.Restart npm run dev, entry files are collected when the build starts. New partials do not need a restart.
A tw: class does nothing.The class must be written out in full in templates/ or components/ and the build must run afterwards. Check the class exists in css/tailwind.css.
Node.js ... is too oldInstall Node.js 20.19+ (nvm install) or run the command in DDEV.
CI job theme-assets fails with "Generated CSS is out of date".Run npm run build and commit the changed CSS files.
The Clone theme section is missing.Run drush cr. The section is shown on the settings page of Holy and of its clones.
Clone fails with "The directory themes/custom is not writable".Create web/themes/custom and make it writable for the web server user (locally).
npm run lint:php cannot find phpcs.Install drupal/core-dev with Composer; the theme must be inside a Drupal project (web/themes/*/THEME). PHPStan also reports missing PHPUnit classes in tests/ without it.

Glossary

Term Meaning
BlockA piece of content placed in a region (menu, branding, search form, view, custom text).
Block layoutAdministration page where blocks are placed into regions, per theme (/admin/structure/block).
BehaviorDrupal's way to run JavaScript on page load and after AJAX (Drupal.behaviors).
ConfigurationSite settings stored in the database and exportable to YAML.
Content typeA type of node (article, basic page) with its own fields.
ContribModules and themes contributed by the community on drupal.org.
DrushDrupal command line tool.
LibraryA named group of CSS and JS files defined in *.libraries.yml.
Machine nameThe internal name of an extension or entity (lowercase, underscores), e.g. holy.
NodeA piece of content (an article, a page).
HookA method (or in older code a function) Drupal calls at a given moment, e.g. preprocess_page before rendering the page template. In themes since Drupal 11.3 a method in src/Hook/ with the #[Hook] attribute.
PreprocessA hook that prepares template variables (preprocess_HOOK).
RecipeA package of modules and configuration applied to a site in one step. See Drupal recipes.
RegionA named area of the page layout declared by the theme.
Render arrayA PHP array describing what to render; Drupal turns it into HTML using templates.
SDCSingle Directory Component: template, definition, CSS and JS in one folder.
StarterkitCore theme used as a template to generate new themes.
Sub-themeA theme that inherits from a base theme. Holy and its clones are not sub-themes.
Template suggestionAn alternative, more specific template name Drupal tries before the default one.
ViewA configurable list of content built with the Views module (e.g. the News listing).