因此,我正在清理项目的结构,并将布局、导航和页脚放在单独的文件夹中。
我现在尝试在我的文件中渲染布局文件,但我似乎无法获得正确的路径。
结构如下
在我尝试过的仪表板/索引中
扩展../layout
,
扩展./layout
&
扩展../../layout
这是layouts.pug 文件
doctype html
html
head
title= title
meta(name='viewport' content='width=device-width, initial-scale=1')
meta(charset='utf-8')
link(rel='stylesheet' href='/stylesheets/output.css')
link(rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css')
body(class='antialiased min-h-screen')
include navigation
include error
block content
include footer
script(src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js')
script(src='https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.1/Chart.bundle.min.js')
script(src='/javascripts/fontawesome-all.min.js' defer)
script(src='/javascripts/site.js')
最佳答案
如果您尝试从另一个文件夹扩展
文件,则必须写出完整路径。您编写 extends
语句的方式仅引用文件夹,而不是我认为您要定位的文件。
extends ./../layout/layout.pug
关于node.js - 从布局文件夹链接layout.pug文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48989502/