pattern-lab / patternengine-php-twig

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

Proof-of-concept Twig 2.x integration #43

Open squidfunk opened 7 years ago

squidfunk commented 7 years ago

For a client project which has Symfony 3 as a dependency I want to be able to use Patternlab with Twig 2.x, which is the default version bundled with the framework. For this reason I forked the project and created a proof-of-concept working version which might be a good starting point for supporting Twig 2.x. This is the corresponding PR.

I think it would be of great use for many developers, but as there are no tests, I'm not a 100% sure I got everything right. Feel free to comment and see this PR as a work-in-progress.

sghoweri commented 6 years ago

Thanks @squidfunk!!

Out of curiosity, have you guys tried using Twig embeds with this implementation?

I'm still experimenting a bit with this locally which, for the most part, works perfectly, however I've noticed that something relating to embeds (but not extends or includes) appears to throw a Twig error relating to a string template not being found...

Have you guys encountered any other problems or strange behavior with this upgrade to Twig v2?

CC @EvanLovely @aleksip

squidfunk commented 6 years ago

To be honest, we switched to patternlab-node and now use twig.js for rendering. The PHP version is so flawed and so slow that we had no choice. twig.js is not a perfect solution, but it works and we can even render twig templates in the browser.