我正在启动一个简单的web应用程序。我使用的构建工具是
Parcel
,模板引擎是
Pug
.根据文档进行的设置似乎微不足道,但目前该应用程序并不是从我开始使用的那一刻开始构建的
extends
在模板中:
$ npm run build
> parcel build src/index.pug
🚨 Build failed.
@parcel/core: Failed to resolve 'index.html' from './src/index.pug'
@parcel/resolver-default: Cannot load file './index.html' in './src'.
💡 Did you mean './index.pug'?
这是本书的内容
index.pug
:
extends _layout.pug
block title
- var pageTitle = "Home"
block content
main
h1 Lorem ipsum dolor sit amet.
p.
Hic voluptatem laboriosam id consequuntur cumque vel ipsum quos. Sed mollitia vitae et similique praesentium
non omnis harum. Non optio aliquid hic amet assumenda et ducimus nihil et harum nihil aut voluptatem iusto aut
doloribus tenetur! Vel porro nihil ut pariatur esse ut magni voluptatibus ut modi laboriosam.
p
span#jquery-loading Loading jQuery...
...这是本书的内容
_layout.pug
:
doctype html
html(lang="en")
head
meta(charset="UTF-8")
meta(content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport")
meta(content="IE=edge" http-equiv="X-UA-Compatible")
block title
title #{pageTitle}
block styles
link(href="/styles/global.css", rel="stylesheet")
link(href="/favicon.svg" rel="icon" type="image/svg+xml")
body
block body
div
block header
include _header.pug
block content
block footer
include _footer.pug
block scripts
script(src="/scripts/global.js", type="module")
我想我可能遗漏了一些非常明显的东西,但到目前为止,我找不到这个设置有什么问题。