jstransformers / jstransformer-nunjucks

Nunjucks support for JSTransformers.
http://npm.im/jstransformer-nunjucks
MIT License
6 stars 6 forks source link

Add includes test #12

Closed RobLoach closed 7 years ago

RobLoach commented 8 years ago

This tests the issue brought up in #10 . Thanks, @ismay. We should figure out why .compile doesn't modify the include paths.

ismay commented 8 years ago

Ok, so I think I've found it, I think nunjucks has problems with relative paths, or at least the ../ part. Changing {% include "../lib/include.html" %} to {% include "lib/include.njk" %} works.

Of course for this to work you'll have to set path to a base that all templates have in common, from which you'll be able to do your includes etc.

Now the weird thing is that setting the path option doesn't work anymore when I set the filename property as well. In jstransformer-nunjucks path has priority over filename, so that should mean that nunjucks does something with filename that prevents this from working, no idea what though.

ismay commented 8 years ago

Might be related to: https://github.com/mozilla/nunjucks/issues/642#issuecomment-173408151