pugjs(jade) template engine loading css file

一曲冷凌霜 提交于 2019-12-20 09:28:02

问题


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?


回答1:


try: link(rel='stylesheet', href='/stylesheets/style.css')




回答2:


I think you need to include the relationship. Try

link(rel='stylesheet', href='my.css')




回答3:


You need to add the type:

link(rel='stylesheet', href='my.css', type='text/css' )



回答4:


if you're using Jade with connect-assets, you can just use:

!= css('stylesheetName')

where stylesheetName.css is in your assets/css/ directory.




回答5:


This works:

html
    head
        style
             include ./style.css
    body


来源:https://stackoverflow.com/questions/7956038/pugjsjade-template-engine-loading-css-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!