I am working on a project using express, node, and ejs and I want to be able to use different stylesheets for different views. In order to render a specific view with its corresponding style, I have included the following in my app.js file:
app.get('/mySite', (req, res) => {
res.render('mySite', { style: 'mySite' });
In this case, let's assume I have created a stylesheet named mySite.css and in my boilerplate.ejs file, I have added a link to the desired styles:
<link rel="stylesheet" type="text/css" href="/stylesheets/<%=style%>.css">
The challenge I am facing is how do I define 'style' without encountering an error saying "style is not defined"?
I apologize if this question pertains to basic knowledge in express, as I am still in the learning process.