如何解决如何在 pug 中使用绝对路径?
根据https://pugjs.org/language/includes.html,如果路径是绝对路径,我应该使用options.basedir
。
app.set("view engine","pug");
app.set("views",process.cwd() + "/src/views");
app.locals.basedir = process.cwd();
所以,我输入了 app.locals.basedir = process.cwd();
// uploadVideoBase.pug
extends /src/views/base.pug
block content
div
section.userContainer
div.userInfo
include ../partials/showAvatar.pug
span My Channel
span=user.username
ul.userChoice
li
i.fas.fa-chalkboard
a(href="#")
span dashboard
li
i.fas.fa-play-circle
a(href="#")
span content
li
i.fab.fa-playstation
a(href="#")
span playList
block dashboard
然后我在 extends /src/views/base.pug
处输入了 uploadVideoBase.pug
。
Error: ENOENT: no such file or directory,open 'C:\Users\kjkks\Documents\wetube\src\views\users\partials\showAvatar.pug'
。
但它给了我一个错误。
我想通过使用 base.pug
在 uploadVideoBase.pug
使用 extends
。我该怎么办?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。