Prem
Prem

Reputation: 652

Stylesheet (CSS) is not loading in my Sails application

I've placed a style sheet style.css inside the /assets/styles-folder and embedded it via <link rel="stylesheet" href="style.css" type="text/css"> in my something.ejs file.

But the stylesheet is not loading. Has anyone an idea?

Upvotes: 1

Views: 1686

Answers (1)

Nikhil Batra
Nikhil Batra

Reputation: 3148

Use the following to give the correct location of style sheet:

<link rel="stylesheet" href="../../assets/styles/style.css" type="text/css">

The first .. will take it to views folder, the next .. will take it to parent folder Employees, now you can give the path to your stylesheet.

This is because the path must always be relative to current .ejs or some other current file's location in the directory.

Upvotes: 1

Related Questions