-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Twig custom paths and namespacing #1604
Comments
I have added preliminary support for this with a new event For backwards compatibility, the loader is initiated as normal with the This means you can add your own paths with namespaces and use them directly such as:
Then:
However, nothing has changed in the core of Grav, and all the standard page templates, and 3rd party plugin templates are still using the default |
This rocks, thanks Andy! |
@mikecrittenden Nice work 👊 |
@mikecrittenden 🙏 |
Namespaces are a very useful concept in Twig. You can see the Symfony implementation here: https://symfony.com/doc/current/templating/namespaced_paths.html#registering-your-own-namespaces
Any chance of adding support for them in Grav? Something like a
twig_paths:
property in the theme YAML that defines paths and the namespaces for them, perhaps?(I'd also appreciate any pointers in setting this up manually via a plugin, because messing with
Twig_Loader_Filesystem::addPath()
has proven to be difficult.)The text was updated successfully, but these errors were encountered: