Automating Single Directory Component Creation in Drupal with YAML Script
A Python-based script written by Anand Toshniwal is streamlining the creation of Single Directory Components (SDCs) for Drupal projects. The script automates the generation of '.component.yml'
files by analyzing Twig templates, reducing manual effort and improving accuracy. By scanning directories for '.twig'
files, it extracts variable definitions, slots, conditionals, and default values, compiling them into the required YAML configuration format. It also identifies array variables and incorporates related include file structures, ensuring the generated files meet SDC specifications.
The tool has gained attention for its potential to enhance efficiency in projects such as the Starshot Demo Design System. Led by Salsa Digital, the Starshot Demo Design System builds on CivicTheme to support Drupal’s Experience Builder, providing a reusable design system for demonstration purposes at events such as DrupalCon Barcelona and Singapore. QED42 has contributed to the project by focusing on SDC automation and testing, while other collaborators bring expertise in design and development to advance its goals.
Members of the Drupal community, including Dries Buytaert, Drupal’s founder, have acknowledged the script's impact, praising Anand’s efforts.
Developers can explore a demo of the tool online. A Drush command version is in development for easier integration. This innovation reflects Drupal's commitment to advancing modular development practices and improving developer workflows.
To get involved with the Starshot Demo Design System, interested contributors can follow the project on GitLab under demo_design_system. To engage with the community, review project documentation, and check the open issue queue for tasks, join the Slack channel #starshot_demo_design_system. Progress updates are available via the Kanban board, and biweekly Slack meetings are held every Tuesday at 7 PM UTC. Suggestions for additional components are welcomed under issue #3479765, and volunteers can refer to the contribution guide to identify tasks they can support.