How to add css file to ejs Express js 1
In this tutorial, we will learn to include/add CSS style file link in your EJS file.
Create a public folder at the root of your project. Create a css folder inside it.
The project directory should look like the below:
Add the following line to the index.js file which is at the root of the project folder:
app.use(express.static(__dirname + '/public'));
Assuming you put the css files in public folder from in your app root. now you have to refer to the css files in your EJS view template files, like:
<link href="/css/style.css" rel="stylesheet" type="text/css">
Hope it hepled!