view all blog posts

Specbee teaches how Emulsify Twig makes it easy to write BEM CSS class names

Randy Oest
Randy OestNovember 11th, 2022

The BEM (Block, Element, Modifier) methodology is a widely used naming convention for CSS classes that is popular because of the ease of use it offers. Find out how Emulsify Twig makes it easy in Drupal.

BEM

We recommend reading "What is BEM (Block, Element, Modifier) and How can it be used with Drupal Emulsify Twig" to learn more about what BEM is and how to implement it in Drupal templates.

In Drupal, we can use the BEM Twig function with the help of the Emulsify Twig module. The BEM function lets you create BEM classes on elements in the components.

BEM methodology is extremely useful to developers who want to write and maintain better quality code that can be easy to be handed over and understood. Every element has a purpose which can be easily identified by its name and which block it is coming from. When used right, you will see that using BEM can boost development speed.

Emulsify is an open-source project that's free for everyone.
Watch an Overview