pugjs(jade) template engine loading css file
Asked Answered
C

5

41

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?

Chucho answered 31/10, 2011 at 15:45 Comment(1)
What does the generated HTML look like?Pure
C
97

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

Celik answered 31/10, 2011 at 16:7 Comment(0)
W
13

I think you need to include the relationship. Try

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

Wriest answered 31/10, 2011 at 16:8 Comment(0)
O
13

This works:

html
    head
        style
             include ./style.css
    body
Orth answered 28/11, 2019 at 19:8 Comment(0)
S
10

You need to add the type:

link(rel='stylesheet', href='my.css', type='text/css' )
Schizogenesis answered 16/8, 2012 at 4:7 Comment(0)
L
3

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

!= css('stylesheetName')

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

Lopeared answered 11/7, 2013 at 19:21 Comment(2)
Can you add a link to the documentation for this?Squally
@Squally This markup is made possible by the Node asset manager, connect-assets. It is one of three global functions provided by that module. github.com/adunkman/connect-assets#markup-functionsLopeared

© 2022 - 2024 — McMap. All rights reserved.