Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add css file link in pug

Tags:

pug

I need to add css file named feed.js with a pug file named feed.pug. i am trying this in feed.pug but it is not working

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

this is my css code;

body{
    background-color: red;
}

I have also tried one or two solutions from stackoverflow but this is not working. pugjs(jade) template engine loading css file

Need help :)

like image 944
palo Avatar asked Oct 27 '25 10:10

palo


1 Answers

This might simply take a little messing around with finding the right location to use. I would imagine you need

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

Note the forward slash in front of feed.css. On the server side, you need something like the below if you are using express.

var express = require('express');
app.use(express.static('css'));
like image 88
freqnseverity Avatar answered Oct 30 '25 14:10

freqnseverity



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!