-
-
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
Let Grav scan/load template files with different extension than *.html.twig #1818
Comments
i think its not this simple. The admin needs to be looked at also. I would prefer to improve this with something more flexible, not just This needs to be tackled at a higher level i think. I will think on this a bit more. |
Does your HAML plugin require these code changes to work??? |
Hello, No it works without modifying Grav core files if you add this first line to all files you want to have haml parsed.
Grav core files modification is only needed if you want the plugin to automatically kick-in when you have *.haml.twig files without adding this first line. |
Hi, |
Hi Everyone, Just wanted to know what is the status of this request ? Do you think we can manage this in 1.6 ? Best |
Hello,
Grav is awesome, I have created a plugin to write template files in HAML with Twig integration. It allows to have concise, clear and short templates. It integrates greatly with Grav and Twig. You can get the plugin here: https://github.com/numito/grav-haml
But I figured out an issue, Grav scans only for .html.twig files in theme folders, also the type 'HTML' and '.html.twig' is not a constant and is redefined in many places in the core files. Grav should have a configurable list of template extensions to scan for and load those templates. By default all template should go through the Twig parser, but a plugin could hook for specific template extension allowing additional template languages.
I made a few simple modifications to core files to allow that, but I am not sure they are exhaustive. I would like some recommendations.
These are the modifications I did to make my plugin work:
Line 60 of Grav\Common\Twig\Twig
Add
Ligne 240 modify
Line 352 modify
Line 72 et 74 de Grav\Common\Page\Types
The text was updated successfully, but these errors were encountered: