A simpler solution to our "keep our templates and component libraries separate" is simply to allow a separate folder from /templates for the component libraries while sharing the Twig namespace.
Twig allows you to specify multiple paths for a Twig namespace. Drupal core only provides the /templates path for a theme's Twig namespace. e.g. bartik/templates is the path for the @bartik Twig namespace.
We could allow theme's to define additional paths for the theme's namespace.
template-paths:
- components
would mean you can place your Twig templates in /templates or in /components directories.
Alternately, we extend the existing .info syntax:
component-libraries:
THEMENAME:
paths:
- templates
- components
[edit: we are going with the alternate as it is more consistent.]
Comments
Comment #2
JohnAlbinI just discovered that Drupal will find Twig templates no matter what sub-folder they are in. The only advantage of putting them in a /templates folder is that you can reference them using the @THEMENAME Twig namespace.
Comment #3
JohnAlbinComment #4
JohnAlbinUpdate the current .info.yml syntax.
Comment #5
JohnAlbinComment #6
JohnAlbinComment #8
JohnAlbinFixed.
Comment #9
JohnAlbin