40

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?

Ya Zhuang
  • 4,652
  • 31
  • 40
Masiar
  • 20,450
  • 31
  • 97
  • 140

5 Answers5

97

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

Ya Zhuang
  • 4,652
  • 31
  • 40
13

This works:

html
    head
        style
             include ./style.css
    body
the_haystacker
  • 1,585
  • 18
  • 20
13

I think you need to include the relationship. Try

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

Ryan Gibbons
  • 3,511
  • 31
  • 32
10

You need to add the type:

link(rel='stylesheet', href='my.css', type='text/css' )
cyberwombat
  • 38,105
  • 35
  • 175
  • 251
3

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

!= css('stylesheetName')

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

ewaltman
  • 51
  • 4
  • 1
    Can you add a link to the documentation for this? – aaronfay Mar 13 '14 at 04:50
  • 1
    @aaronfay This markup is made possible by the Node asset manager, _connect-assets_. It is one of three global functions provided by that module. https://github.com/adunkman/connect-assets#markup-functions – ewaltman Aug 17 '14 at 11:24