How to use multiple css files in one page in Express Handlebars

35 Views Asked by At

I have three pages Home, About and Create. I need to use 2 stylesheets for each page, one for the style and another for responsiveness. But it doesn't seem to work.

This is how one of my directory looks like

enter image description here

I've included the middleware as well app.use(express.static('public'));

And in the main.handlebars, I've added this <link rel="stylesheet" href="/css/{{style}}" />

And this is one of my page's routing

app.get('/create', (req,res) => {
    res.render('create', {
        title: 'Blogger - Create',
        style: ['create.css', 'responsive.css'],
    });
});

However it works if I use a single css file

app.get('/create', (req,res) => {
    res.render('create', {
        title: 'Blogger - Create',
        style: 'create.css',
    });
});
0

There are 0 best solutions below