我的 express 元素中有一个 .pug 模板,该模板不包含其样式表。我已经查看了哈巴狗的文档,但没有用 :( 我不确定该怎么做
文件树:
views
`-- index.pug
`-- css
`-- styles.css
我正在尝试包含 3 个样式表:styles.css(个人样式表)、 Bootstrap CDN(我已经在我的元素中安装了 Bootstrap )和谷歌字体样式表
谁能告诉我我做错了什么?
doctype html
html(lang="en")
head
title Cloudii Weather Analysis
style
// BOOTSTRAP link(rel='stylesheet' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css'
integrity='sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u' crossorigin='anonymous')
//GOOGLE FONTS link(rel='stylesheet', href='https://fonts.googleapis.com/css?family=Pacifico&display=swap')
// STYLES.CSS link(rel='stylesheet', href='./css/styles.css')
body
img(src='images/cloudii_bg.png')
div
h2 cloudii
img(src='images/cloudii_logo.png')
div.form-row
div.form-group.col-md-6
label.label city
input#inputCity.form-control
div.form-group.col-md-4
label.label state
select(id="inputState" class="form-control")
each state in states
option(value=state.id) #{state.name}
div(class="form-group col-md-2")
label.label zip
input(type="text" class="form-control" id="inputZip")
button(id="submit" type="submit" class="btn btn-primary btn-lg btn-block hoverable">check weather)
最佳答案
我必须将 express.static 指向 views 文件夹,然后将样式表放在 views 文件夹中,它就可以工作了!
关于css - 哈巴狗模板不包括样式表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59507386/