pattern-lab / patternengine-php-twig

Twig-based PatternEngine for Pattern Lab.
http://patternlab.io/
MIT License
78 stars 36 forks source link

Adds event "twigLoaderPreInit.customize" #32

Closed EvanLovely closed 8 years ago

EvanLovely commented 8 years ago

This allows plugins to manipulate the loaders list before the Twig Environment is initialized. There already is an event after initialization that allows one to change many things with the Twig Environment, however the problem I came across was when one tried to add more loaders. Turns out that no loader can go after Twig_Loader_String as that loader will interpret anything as a template and try to render it, so no loader can come after it. That is used by core for the rendering of the header and footer. It also is responsible for the mis-typed twig paths to simply output something like this:

@molecules/path/to/file.twig

I'd like to get that fixed as that's a silent error, but that's another issue for another day.