首页 文章

Pug文件没有加载CSS

提问于
浏览
1

我有一个快速项目设置 . 我正在使用Pug作为视图引擎 .

我的app.js中有以下几行,

app.set('views', path.join(__dirname, './views'));
app.set('view engine', 'pug');
app.use(express.static(path.join(__dirname, './public')));

我在index.pug视图中有以下内容,

link(rel='stylesheet', href='/stylesheets/style.css', type='text/css')
    link(rel='stylesheet', href='/stylesheets/boostrap.min.css', type='text/css')

CSS文件位于正确的文件夹(公共/样式表)中,但是当我加载应用程序时,视图似乎没有加载CSS文件 .

可以找到包含其目录和所有代码的完整项目here

2 回答

  • 0

    Typo在你的bootstrap链接中,你有boo s 陷阱:

    link(rel='stylesheet', href='/stylesheets/boostrap.min.css', type='text/css')
    
  • 5

    我的代码正在使用这个

    doctype html
    html(lang='en')
      head
        link(rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4" crossorigin="anonymous")
    
        title Jade
      body
        h1 Jade - node template engine
    

相关问题