* Renders template using given data. * * This is low-level function, for rendering full templates use Template.render(). * * @param {string} file - Template filename. * @param {object} data - Template variables (doesn't have to be object, but passing variables dictio
(file, data)
| 44 | * @return {string} Rendered template. |
| 45 | */ |
| 46 | partial(file, data) { |
| 47 | file = path.resolve(this.path, file); |
| 48 | |
| 49 | // load template into cache |
| 50 | if (!(file in this.cache)) { |
| 51 | this.cache[file] = this.load(file); |
| 52 | } |
| 53 | |
| 54 | // keep template helper context |
| 55 | return this.cache[file].call(this, data); |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * Renders template with given data. |