当前位置:网站首页>Replace jade engine with EJS

Replace jade engine with EJS

2022-06-13 08:41:00 huangxunlove

In the use of express When the framework , The default engine is jade,views It will generate the following
 Insert picture description here
And for jade What I am not familiar with can only be changed into ejs.

  1. see express edition
express --version

 Insert picture description here

  1. install ejs
npm i ejs -s

3.view Engine changes
 Insert picture description here
Delete... At this time views Under the index.jade, add to index.ejs, Fill in the following code

<h1>
    <%= title%>
</h1>
<p>
    welcome to <%= title%>
</p>

again npm run start, Visit the browser
 Insert picture description here
Change succeeded !!!
 Insert picture description here

原网站

版权声明
本文为[huangxunlove]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202270538542767.html