Pug file not loading CSS

Issue

I’ve got an express project set up. I’m using Pug as the view engine.

I’ve got the following lines in my app.js,

app.set('views', path.join(__dirname, './views'));
app.set('view engine', 'pug');
app.use(express.static(path.join(__dirname, './public')));

And I’ve got the following in my index.pug view,

    link(rel='stylesheet', href='/stylesheets/style.css', type='text/css')
    link(rel='stylesheet', href='/stylesheets/boostrap.min.css', type='text/css')

The CSS files are in the right folders (public/stylesheets), but when I load up the app, the view does not seem to load the CSS files.

The full project with its directories and all the code can be found here

Solution

Typo in your link to bootstrap, you have boostrap:

link(rel='stylesheet', href='/stylesheets/boostrap.min.css', type='text/css')

Answered By – worc

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published