Mariusz
Mariusz

Reputation: 607

Openshift can't find my css file

I managed to create a new app on Openshift and the basic template that they provided me with is working. The only thing I added to it is:

<head>
...
<link href="styles.css" rel="stylesheet">
</head>

and a file styles.css in the same directory as index.html. In the css file I just changed the footer to red. When I click on index.html my browser shows the changes, but when I upload the files to Openshift nothing changes and I get:

GET http://bgl-boardgamelab.rhcloud.com/styles.css 404 (Not Found)

I think I'm making some silly mistake, but can't figure what it is.

Upvotes: 3

Views: 766

Answers (3)

Mariusz
Mariusz

Reputation: 607

Turns out I had to add the following to my .initializeServer function to serve all my static files:

self.app.use(express.static(__dirname));

Upvotes: 2

Joci93
Joci93

Reputation: 823

Try full path url like:

<link href="http://localhost/myproject/styles.css">

or

<link href="http://examplesite.com/styles.css">

Upvotes: 0

maioman
maioman

Reputation: 18734

try

<link rel='stylesheet' href='styles.css' type='text/css' media='all' />

Upvotes: 0

Related Questions