반응형
Your problem is not actually specific to ejs.
2 things to note here
-
style.css is an external css file. So you dont need style tags inside that file. It should only contain the css.
-
In your express app, you have to mention the public directory from which you are serving the static files. Like css/js/image
it can be done by
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 tamplate files, like
<link href="/css/style.css" rel="stylesheet" type="text/css">
Here i assume you have put the css file in css folder inside your public folder.
So folder structure would be
.
./app.js
./public
/css
/style.css
반응형
'웹프로그래밍 > node.js & Typescript' 카테고리의 다른 글
안전한 any 타입 만들기 (0) | 2020.02.11 |
---|---|
[node.js] require is not defined in typescript (0) | 2018.08.30 |
[node.js] Unable to include relative path file using Jade Template (0) | 2015.06.23 |
[node.js] socket set() get() depracated! (socket.io) (0) | 2015.06.11 |
[node.js] How to use layout.ejs in Express 4 (0) | 2015.06.11 |