在express中设置view engine为html,express-partials会导致语法不正确,其实只要做一行代码的改动就可以

 

function renderer(ext){
if(ext[0] !== '.'){
ext = '.' + ext;
}
//新增一行代码
if(ext == '.html') ext = '.ejs';
return register[ext] != null
? register[ext]
: register[ext] = require(ext.slice(1)).render;
};

 

为了方便部署,我将这个方法封装在了nodexcn包中。

可以直接使用npm install nodexcn

 

https://www.npmjs.org/package/nodexcn

http://nodex.cn/

相关文章:

  • 2021-05-31
  • 2021-08-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-19
  • 2021-11-19
  • 2021-11-29
猜你喜欢
  • 2021-07-11
  • 2021-09-28
  • 2022-12-23
  • 2021-05-13
  • 2021-07-05
  • 2021-09-15
相关资源
相似解决方案