Using EJS without NodeJS

爷,独闯天下 提交于 2021-02-05 08:14:18

问题


I figured that the latest build release would allow me to use ejs globally without using node so I tried doing so.

Though, when I try to use ejs.renderFile(params...), i get the error:

TypeError: exports.fileLoader is not a function

Which is just another node module. Is there a way to get around this?

Note: This is the only time we use EJS at my company, so, if not, would you kindly point me in a good direction in how to render .ejs files.


回答1:


Update: You can create an EJS object by running

new EJS({url: some/url/to/file.ejs}).render({dataToPass: data, moreData: secondData});


来源:https://stackoverflow.com/questions/61100840/using-ejs-without-nodejs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!