I'm looking for Node.js templating engines that are similar to PHP in that they allow full access to the server and support simple text insertion. I've checked out EJS, but it seems like it doesn't provide complete system access. I'm considering creating my own templating engine but I'm already aware that it might be pretty challenging.
3 Answers
Have you looked into using Express along with a templating engine? Handlebars might be a good fit for you since it's pretty straightforward for those transitioning from PHP. By the way, what do you specifically mean when you say 'full system access to the server'?
I've been working on a templating engine myself. There's definitely more to it than just templating, but it's a lot more similar to PHP than any other Node.js options I've tried. If you're curious, feel free to reach out!
To clarify, EJS does provide full system access in a sense, but it has limitations during template rendering. I’ve faced similar issues when trying to read files on the server; it seems you must handle the file reading in Express and pass that data to EJS, rather than doing it directly in the template.
I think of EJS as lacking 'full system access' because you can't directly read a file within the template itself. You have to load the file in your Express server code first and then pass the content to the template.