我刚刚开始了一个小项目的节点和表达式使用玉作为视图引擎,但由于某些原因,我不知道.
我的看法是:
doctype html
html
head
meta(charset='utf-8')
title= 'Admin / ' + title
link(ref='stylesheet', href='https://storage.googleapis.com/code.getmdl.io/1.0.5/material.indigo-pink.min.css')
link(ref='stylesheet', href='/public/css/style.css')
body
block content
script(src='/public/material-design-lite/material.min.js')我使用了官方来源的mdl样式表,以确保它与我的静态文件夹路由没有问题。
我的财务主任:
export default class Dashboard {
constructor(req, res) {
res.render('admin/dashboard', {
title: 'Dashboard'
});
}
}核心:
import express from 'express';
import {Routes} from './config/config';
export default class Core {
constructor() {
this.app = express();
this.app.set('view engine', 'jade');
this.app.set('views', __dirname + '/views');
let routes = new Routes();
this.app.use('/', routes.get());
this.app.use('/public', express.static('public'));
this.app.use('/public/material-design-lite', express.static('node_modules/material-design-lite'));
this.app.listen('3000', () => {
console.log('Listening on ::3000');
});
}
}我没有看到任何问题,但不知何故,样式表没有加载,但是脚本加载得很好,如果我试图直接加载样式表,它们也会加载得很好。
拜托,如果有人能帮我,我会非常感激的!
提前谢谢。
发布于 2015-10-19 22:45:31
应该是rel而不是ref
link(rel='stylesheet', href='/public/css/style.css')
^^^https://stackoverflow.com/questions/33225155
复制相似问题