mde / ejs

Embedded JavaScript templates -- http://ejs.co
Apache License 2.0
7.77k stars 842 forks source link

Step-by-step compilation of templates #443

Open JohnScience opened 5 years ago

JohnScience commented 5 years ago

I have an EJS-based Express website. I was fine simply delegating the rendering of the views to Express, however at some point I decided to precompile EJS for better performance. I was searching the web for a way to accomplish this and almost gave up. I just came up with a rather weird solution, I decided to use different delimiters for each stage of compilation however this approach is not suggested anywhere. Can you add a hint for developers that want to do the same?

mde commented 5 years ago

I have done something somewhat similar back when I was still working on generators for the Geddy MVC framework. We had EJS code that generated EJS templates, so we used the '@' delimiter in the generator to create standard EJS code with the '%' delimiter.

mde commented 5 years ago

Please feel free to submit a PR with updates to the README, or a PR for the doc site. It's at https://github.com/mde/ejs-site.