Reputation: 3
My CSS code won't apply to an ejs file. But for some reason, it applies to every other ejs file. My app structure is ... (using nodejs and express)
app.js
util
routes
controllers
models
public
-css
-main css, etc
-admin css folder
-admin-page1 css
-admin-page2 css
views
- includes (contains header/end.ejs)
- admin folder
- admin-page1 ejs
- and so on..
in app.js, i have:
app.use(express.static(path.join(__dirname,"public")));
in my ejs files, I do include my ejs header file.
my header ejs file in my includes folder contains all the CSS files
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title><%=pageTitle%></title>
<link rel = "stylesheet" type = "text/css" href = "css/main.css" />
<link rel = "stylesheet" type = "text/css" href = "css/bio.css" />
<link rel = "stylesheet" type = "text/css" href = "css/admin/admin_request-list.css" />
<link rel = "stylesheet" type = "text/css" href = "css/amin/admin_single-request.css" />
<link rel = "stylesheet" type = "text/css" href = "css/quote_form.css" />
<link rel = "stylesheet" type = "text/css" href = "css/hp-services.css" />
I tried everything and like I said it doesn't work for one admin ejs file but I copied code from one ejs file and pasted into this one to see if it some error I have done but it still doesn't work.
Any help would be appreciated! I'm just trying to get past this annoying step
Upvotes: 0
Views: 1228
Reputation: 1
You need just get rid of type="text/css". For example, this link:
<link rel = "stylesheet" type = "text/css" href = "css/main.css" />
we change to this one:
<link rel = "stylesheet" href = "css/main.css" />.
Upvotes: 0
Reputation: 24
The best solution to use Imoport files on main CSS file
@import url("bio.css");
@import url("quote_form.css");
@import url("hp-services.css");
@import url("admin/admin_request-list.css");
@import url("admin/admin_single-request.css");
Upvotes: 0