Integration with Storybook
Up to now, we have defined our components in Storybook and then incorporated them into Drupal; this involved using Twig.js and some extra work to ensure compatibility with Drupal’s JavaScript behaviors.
This approach has some pros and cons:
Pros
- Build the component library in a (nearly) Drupal-independent way (you can start working on components without having a Drupal website)
- Quickly move the component library to a new project
- Simplify the building of complete pages on Storybook, starting from defined components
Cons
- Twig.js differs from Twig, which may lead to some inconsistencies in components when viewed in Storybook versus Drupal
- Storybook ignores the entire render pipeline of Drupal, which can also lead to inconsistencies
- If a component uses some JavaScript from Drupal, you need to provide a way to include this in Storybook
SDC took the opposite approach: components are instead defined inside...