CSS 不适用于 jade [英] CSS doesn't work with jade

查看:50
本文介绍了CSS 不适用于 jade的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用 node.js 和 jade 设置了一个应用程序.

I've set up an app with node.js and jade.

这是我的观点:

html
    head
        title My test page

        link(rel='stylehseet', link='/css/main.css')
    body
        h1 My Jade template
        p= message

        a(href='/about') About

问题在于 link 标签.它不加载 css.如果我将其更改为 <link rel="stylesheet href="/css/main.css"/>(将 jade 换成常规 css),它会起作用.

The problem is the link tag. It doesn't load the css. It works if I change it to <link rel="stylesheet href="/css/main.css" /> (swapping out the jade for regular css).

这就是我服务和路由 index.html 的方式:

This is how I serve and route index.html:

app.use(express.static(__dirname));

app.get('/', function(req, res) {
    res.locals.message = 'Hello!';
    res.render('index');
});

推荐答案

也许这只是一个错字,但你有 stylehseet :

Maybe it's just a typo but you have stylehseet :

link(rel='stylehseet', link='/css/main.css')

代替样式表

link(rel='stylesheet', href='/css/main.css')

这篇关于CSS 不适用于 jade的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆