Skip to main content
Back to work Samuel
Mortenson

Single File Components

Simplifying the Drupal frontend
Code for a single file component.

After reviewing Vue.js's implementation of Single File Components, I was inspired to bring something similar to Drupal. Drupal's frontend is notoriously complex, and many projects have tried to bring component based design to Drupal. The main differentiator of the Single File Components Drupal module is that there's only one file for your Twig template, CSS, and JavaScript. Once you write a .sfc file you can include it in any other Twig template, or even derive a block or layout to use in the admin interface.

There's a lot more information in this blog post, if you want to know more.

Project page: https://www.drupal.org/project/sfc