Open kolesnikova-tavi opened 8 years ago
Please take a look at this gist I created:
https://gist.github.com/rhengles/2a4b4df5aedb063f6a8d79029f66f47b
Maybe we could use this issue to improve the documentation in this regard.
PR for improved documentation would be most welcome!
It works! Thanks a lot! Can I pass variables to precompile method?
@kolesnikova-tavi No. You can add filters and extensions [1], but the context variables are only used on the render method.
it's a pity. OK, thank you!
I'm trying to use gulp to precompile templates. My plan is: 1) Precompile templates to some files; 2) Require; 3) Use render.
I'm doing something like this (gulpfile.js):
gulpNunjucks.precompile does this:
Then in my node project js-file:
let templates = require('./moduleName/templates');
And I need something like this:
() This way to use precompiled files with tag script. How can I get function without using window object? () How can I pass context? () I can't see how use precompiled templates.
Is any way? Thanks!