Tools for Emulsify themes and component-driven Twig templates

Emulsify Tools is a companion module for Emulsify. It provides the Drupal-side utilities that help Emulsify-based themes work cleanly with component-oriented Twig templates, reusable namespaces, Drush commands, and deployment-friendly favicon workflows.

Use Emulsify Tools when your Drupal project uses Emulsify and you want a supported way to generate child themes, keep template class naming consistent, register component namespaces from your theme, and manage generated favicon packages across environments.

What Emulsify Tools provides

  • Twig helper functions: use bem() to generate BEM-style class names and add_attributes() to merge Drupal template attributes into reusable component templates.
  • Theme-defined Twig namespaces: register component paths in a theme’s .info.yml file so templates can reference components with namespace syntax such as @atoms/button/button.twig.
  • Twig switch/case support: use switch, case, default, and endswitch tags for clearer conditional logic in Twig templates.
  • Child theme generation: generate Emulsify child themes with Drush using drush emulsify_tools:bake my_theme.
  • Favicon deployment commands: generate, inspect, reset, and repair generated favicon package state for Emulsify-based themes.
  • Emulsify 7 upgrade support: backfill favicon configuration and repair older generated child themes so they can participate in the Emulsify 7 favicon workflow.

Current stable release: 2.x

The 2.x release line is intended to pair with Emulsify 7.x. It targets Drupal ^11.3 || ^12 and supports Drush 13+ command workflows.

The Twig helpers, switch/case extension, and namespace support are useful for Emulsify-based Drupal themes in general. The favicon migration, generated favicon package, and admin-theme favicon features are designed for the Emulsify 7.x companion theme APIs.

If you are maintaining an Emulsify 6.x project, use the 1.x release line of Emulsify Tools. Use 2.x for new Emulsify 7.x work and Drupal 11.3+/12-ready projects.

Favicon deployment workflow

Emulsify 7.x stores portable favicon source data and generated package metadata in theme settings. Emulsify Tools provides the Drush commands that make that workflow reliable after deployments and configuration imports.

  • drush emulsify_tools:favicon-generate my_theme generates or refreshes a favicon package from saved Emulsify theme settings.
  • drush emulsify_tools:favicon-status my_theme reports package state, dependency availability, and portable SVG source status.
  • drush emulsify_tools:favicon-reset my_theme removes generated package state and restores default favicon behavior.
  • drush emulsify_tools:repair-favicon-config my_theme backfills missing favicon config and schema entries in older generated child themes.

Installation

Install Emulsify Tools with Composer:

composer require 'drupal/emulsify_tools:^2.0'

Emulsify Tools is typically installed alongside Emulsify:

composer require 'drupal/emulsify:^7.0'

composer require 'drupal/emulsify_tools:^2.0'

Related projects

  • Emulsify: the Drupal parent/base theme for Emulsify-based Drupal projects.
  • Emulsify Core: frontend build tooling, Storybook integration, Sass, JavaScript, React, and Twig support.
  • Emulsify documentation: project guides, release information, and supporting documentation.

Documentation and development

All issue tracking and contribution work happens on GitHub.

Supporting organizations: 

Project information

Releases