fastify / point-of-view

Template rendering plugin for Fastify
MIT License
344 stars 87 forks source link

How to use the include directive in the esj file #256

Closed borodovisin closed 3 years ago

borodovisin commented 3 years ago

Prerequisites

Issue

The readme file is a little odd to follow. It's confusing the include directive. In the readme file the example just mention putting this piece of code in the ejs file: <% include header.ejs %>. But that code doesn't work and the lib fails trying to parse it.

In my personal case, I have to search inside the examples in the repo to figure it out how to use it, at the end in some example appears in this way: <%- include("./braintree.ejs") %>. Not sure if the readme file can be enhanced with a more accurate description on how to include partial ejs files, and maybe include a link to the example file: templates/index-with-includes.ejs

Hope this can save time for other readers...

mcollina commented 3 years ago

Would you like to send a PR to improve the README?

borodovisin commented 3 years ago

Hi @mcollina, sure, I'll create a PR for this one, sorry for the delay I have been a little busy.

borodovisin commented 3 years ago

Was fixed on this PR: https://github.com/fastify/point-of-view/pull/262