【问题标题】:pug template not including stylesheets哈巴狗模板不包括样式表
【发布时间】:2020-04-17 19:34:36
【问题描述】:

我的 express 项目中有一个 .pug 模板,但不包括其样式表。我已经检查了哈巴狗的文档,但它没有用:(我不知道该怎么做

文件树:

views
`-- index.pug
`-- css
    `-- styles.css


我正在尝试包含 3 个样式表:styles.css(个人样式表)、一个引导 CDN(我已经在我的项目中安装了引导程序)和一个 google 字体样式表

谁能告诉我我做错了什么?

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)

【问题讨论】:

  • 您是否期望pug 在其渲染输出中包含css 文件的内容? link 标签也不应该在 style 标签内

标签: css express pug


【解决方案1】:

我必须将 express.static 指向 views 文件夹,然后将样式表放在 views 文件夹中,这样就可以了!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-27
    • 1970-01-01
    • 2018-01-02
    相关资源
    最近更新 更多