RejectedSoftware Forums

Sign up

How to set right to css when hosting static page?

What path should I set when I am hosting static page?

<link rel="stylesheet" type="text/css" href="site.css">

after running site on locahost css file do not handling, so it's path should be to another value.

Re: How to set right to css when hosting static page?

On Sat, 13 Jun 2015 18:26:22 GMT, Suliman wrote:

What path should I set when I am hosting static page?

<link rel="stylesheet" type="text/css" href="site.css">

after running site on locahost css file do not handling, so it's path should be to another value.

Howdy,

In my diet template I have the following line:

link(rel="stylesheet", type="text/css", href="#{req.rootDir}css/offsets.css")

When compiled, I have the resulting line:
<link rel="stylesheet" type="text/css" href="./css/offsets.css"/>

Re: How to set right to css when hosting static page?

On Sat, 13 Jun 2015 18:26:22 GMT, Suliman wrote:

What path should I set when I am hosting static page?

<link rel="stylesheet" type="text/css" href="site.css">

after running site on locahost css file do not handling, so it's path should be to another value.

Howdy,

In my diet template I have the following line:

link(rel="stylesheet", type="text/css", href="#{req.rootDir}css/offsets.css")

When compiled, I have the resulting line:
<link rel="stylesheet" type="text/css" href="./css/offsets.css"/>

Re: How to set right to css when hosting static page?

On Sat, 13 Jun 2015 18:26:22 GMT, Suliman wrote:

What path should I set when I am hosting static page?

<link rel="stylesheet" type="text/css" href="site.css">

after running site on locahost css file do not handling, so it's path should be to another value.

Howdy,

In my diet template I have the following line:

link(rel="stylesheet", type="text/css", href="#{req.rootDir}css/offsets.css")

When compiled, I have the resulting line:
<link rel="stylesheet" type="text/css" href="./css/offsets.css"/>

Re: How to set right to css when hosting static page?

On Sat, 13 Jun 2015 18:26:22 GMT, Suliman wrote:

What path should I set when I am hosting static page?

<link rel="stylesheet" type="text/css" href="site.css">

after running site on locahost css file do not handling, so it's path should be to another value.

lol, I hit 'tab' 'space x 4' trying to indent, and triple posted...

Anyways, my css directory is in the public folder, located at projectname/public/css. Set the public directory with the line:

router.get("*", serveStaticFiles("./public/"));

Re: How to set right to css when hosting static page?

I found next solution:

void main()
{

	auto settings = new HTTPServerSettings;
	settings.port = 8080;
	settings.errorPageHandler = toDelegate(&errorPage);

	auto router = new URLRouter();
	router.get("*", &index);

	listenHTTP(settings, router);

	registerRestInterface(router, new SO());
	auto routes = router.getAllRoutes();

	runEventLoop();

}

void index(HTTPServerRequest req, HTTPServerResponse res)
{
	serveStaticFiles("./public/")(req,res);
}