In an earlier post, I was showing a new way to
Add a reference to EJS in the head of your html document:
EJS uses a template file to store presentation/markup. It looks a lot like ASP and Ruby on Rails, and it, indeed,
helped clean up the string concatenation in my earlier example:
Back in my main Html page, I set up some data in an array. Getting it to display couldn't have been simpler:
EJS was able to access my data and display it. However, it rendered my Html tags as text. It seems like I did it
exactly the way their demo did it, but how to make the Html tags work? I didn't find anything in EJS's very sparse
documentation that explained why this was happening.
I also had difficulty getting EJS to read in a JSON file and render it the same way it would for JSON data that lives in the same Html file.
I took a look at EJS's source. Why do even open source projects feel the need to obfuscate their code? Does it really optimize performance significantly to put everything on one line of code? Also I was a little surprised to see dependencies on ActiveX objects. Does this mean EJS will only work on a Windows computer?
Check EJS out for yourself:
My demo is here.