CSS pugjs(jade) 模板引擎加载css文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7956038/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
pugjs(jade) template engine loading css file
提问by Masiar
I've been searching in the examples on the GitHub but I couldn't find how to load a simple css file into my layout. My first thought was doing something like this link(href="my.css")
but it seems it's not working at all. The href points to a correct location online (checked and working) thus maybe I'm forgetting something?
我一直在 GitHub 上的示例中搜索,但找不到如何将简单的 css 文件加载到我的布局中。我的第一个想法是做这样的事情,link(href="my.css")
但似乎根本不起作用。href 指向正确的在线位置(已检查并正常工作),因此也许我忘记了一些东西?
回答by Ya Zhuang
try: link(rel='stylesheet', href='/stylesheets/style.css')
尝试: link(rel='stylesheet', href='/stylesheets/style.css')
回答by Ryan Gibbons
I think you need to include the relationship. Try
我认为你需要包括这种关系。尝试
link(rel='stylesheet', href='my.css')
link(rel='stylesheet', href='my.css')
回答by cyberwombat
You need to add the type:
您需要添加类型:
link(rel='stylesheet', href='my.css', type='text/css' )
回答by ewaltman
if you're using Jade with connect-assets, you can just use:
如果您将 Jade 与连接资产一起使用,则可以使用:
!= css('stylesheetName')
where stylesheetName.css
is in your assets/css/
directory.
这里stylesheetName.css
是你的assets/css/
目录中。
回答by the_haystacker
This works:
这有效:
html
head
style
include ./style.css
body