simon-dt / gulp-twig

Twig plugin for gulp.js, The streaming build system. Looking for maintainer or collaborators. See wiki
https://github.com/zimmen/gulp-twig/wiki/Looking-for-maintainer-or-collaborator(s)
MIT License
62 stars 33 forks source link

[Feature] Inline Includes #15

Open d-simon opened 8 years ago

d-simon commented 8 years ago

I needed this to prepend an include when generating the styleguide over here. For this I integrated inline includes as implemented in a different gulp-twig implementation.

A noteworthy change is line 78 in index.js. Instead of passing a file path, the plugin now passes the file.contents as string to Twig. This was necessary for my use case. Is there any downside to this?

Secondly, I introduced three dependenies (lodash.merge, lodash.isarray and glob).

And lastly, I have not written any tests for this. Though the current ones are passing.

What are your thoughts on this? :-)

Important: Not ready to merge! To make this work, I had to disable the cache of Twig, which has a very subtle bug with the id of templates (I will open a PR and cross-reference it here). => Before anything the bugfix will first have to be approved and make it into a release of Twig.js.

olets commented 7 years ago

I notice you're working off a significantly outdated version of twig.js. Was there a reason you chose backflip's fork? At the time of his work, the only difference was a small change to ID validation. Have you tried using gulp-twig with the latest twig.js, for example via

https://github.com/olets/gulp-twig#update-dependencies

? (see also #32)