Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Consider extending Drupal.theme allow templating with Twig as well.
Reason for including this would be so that you possibly re-use templates that are being produced on the front-end and have a consistent templating syntax. Also having twig functions could be great too;)
Proposed resolution
Add https://github.com/justjohn/twig.js/
Remaining tasks
- Add the Twig JS library to core.
- Integrate somehow into theme functions.
API changes
Additional templating to mirror the backend templates.
Comments
Comment #2
nod_The issue summary needs an argumented "why". If more details could be added about: "Integrate somehow into theme functions" that'd be great too.
What about all the drupal specific twig functions we added? how that'd works with something like twigjs, do they have an api to extend what it does?
Comment #3
joelpittetNot sure if the JS version has the ability to extend or if JS has the ability to use such features.
The reason I brought this up was I saw people implementing Drupal.theme.whatever and it seemed like it would be handy to template consistently. Won't be in 8.0.x but maybe something to revisit once the branch opens.
Comment #6
joelpittetThis may be something for Ideas queue... not sure, opening to see if others are interested
Comment #16
nod_This approach didn't pick up with the whole decoupled movement. Closing for now as reusability of twig templates are not really what frontend folks expects from us.