Skip to Content

Luca Lusso Modernizing Drupal 10 Theme Development

He’d been called in as a freelance front-end architect. The client, a fast-growing tech magazine, complained that their site felt “sluggish” and that their designers were “fighting the theme.” Luca had seen this before. The previous developer had simply ported a Drupal 7 theme forward, layering patch upon patch. The styles.css file was 8,000 lines of spaghetti. The JavaScript was a jQuery meatball. And the template files ( html.twig , page.html.twig ) were littered with deprecated variables.

try // 3. Modern Fetch API const response = await fetch(endpoint, method: 'POST', body: formData, headers: 'Accept': 'application/json', , );

use Drupal\Core\Url;

He dragged one of the old, tangled node templates into the component. The old code read:

document.querySelectorAll('[data-dynamic-counter]').forEach((el) => once('counter', el).forEach(async (element) => const data = await fetchData('/api/stats'); element.textContent = data.views; ); ); luca lusso modernizing drupal 10 theme development

On Sunday night, Luca ran the final build. He used Drupal 10’s new auto-setup CLI to spin up a test environment, ran phpunit on his custom theme settings, and pushed the changes.

Luca Lusso: Modernizing Drupal 10 Theme Development Drupal 10 theme development has shifted from traditional, rigid template overrides toward a modular, performance-first ecosystem. Luca Lusso, a veteran Drupal contributor with over 15 years of experience, has been at the forefront of this transformation through his comprehensive guide, . His approach bridges the gap between modern design systems and Drupal’s complex backend, offering a roadmap for creating high-performance, maintainable themes. 1. Embracing Component-Based Development He’d been called in as a freelance front-end architect

The real magic came when he integrated Tailwind’s @layer components with Drupal’s SDC (Single Directory Components). He configured postcss.config.js to scan the components/ folder. Now, unused CSS was purged automatically. Build times dropped from 12 seconds to 0.8 seconds.

Save this page