Open bmiller59 opened 8 years ago
Hey! The Twig engine is super early in its life, and hasn't reached what I would call a point of stability yet. That said, I'm getting exactly the same errors in a project I'm doing right now with Handlebars, so stay tuned.
Thanks for the quick reply. Let me know what you find out. :)
This bug (https://github.com/pattern-lab/patternlab-node/issues/418) describes my issue. Do you think that's related to yours?
Hmmm. It could be, but the feeling I get is that it is a more general problem where patternlab is trying to use mustache to render the twig files rather than the twig engine...
It's possible! I'd encourage you to hack on your copy of the twig engine and do a little debugging if you're up for it. If you put a console.log() in the renderPattern method of the twig engine you could test that theory.
We decided to go another route with our workflow for now, so I do not need this right now. Feel free to close if you would like. Thank you.
I would love to see twig engine native. Another more stable alternative is Nunjucks (since 2012, by mozila) https://mozilla.github.io/nunjucks/ most of the features of twig are implemented in nunjucks (maybe more), and the syntax is very very close to twig.js.
+1 for Nunjucks. Been thinking about trying to build the engine myself, but not sure where to begin.
If anyone is interested, I've been working on a Nunjucks engine. It's still early, but it appears to be working well. Find it at https://github.com/pattern-lab/patternengine-node-nunjucks.
@danwhite85 this is awesome! I have yet to check it out but am crazy excited by the prospect. (saw you email too, will respond as soon as I unbury the rest of my inbox)
@katiemfritz were you hoping for a nunjucks solution?
@bmuenzenmeyer I was looking into it earlier this year as an alternative to the Twig engine for PL Node (which was missing some key features). I'm going in a different direction now though (Vue).
However, if you (@danwhite85) need help testing it out, I'd be happy to help.
Hi. I am using Pattern Lab Node v2.0.0 on Mac, using the gulp edition.
I am trying to get patternlab gulp node set up to use twig rather than mustache since we are working towards a wordpress theme using twig but use gulp for our front end workflow.
I npm installed patternengine-node-twig and then manually dropped in the source files from starterkit-twig-demo and fired up gulp patternlab:serve but I got a lot of "Invalid template!" errors during build.
Error detail: [TypeError: Invalid template! Template should be a "string" but "undefined" was given as the first argument for mustache#render(template, view, partials)]
Can you sketch out the additional config changes to get patternlab node edition working with twig templates instead of mustache templates?
I appreciate it.