tj / consolidate.js

Template engine consolidation library for node.js
3.48k stars 357 forks source link

Using data in partials #308

Open nltesown opened 6 years ago

nltesown commented 6 years ago

Partials lack some documentation. I've tried and seen that a partials object is exposed to the templates and is used to import the partials. Now I need to find out how a partial can use the data passed to the main template. Is it even possible? I've tried, but the partial is rendered literally. (I use the lodash engine).

doowb commented 6 years ago

lodash doesn't handle partials directly so it's not possible to use them directly through consolidate. However, someone just updated underscore to support partials. I think this can be done with lodash too. If you would like to submit a PR with the changes to add support for partials and the tests required, I'll review it. Also, if you'd like to submit a PR with more documentation around partials, I'll review that too!

Thanks