CSS loading issue

Hi,
I am attempting to load custom CSS from a local directory, but I can’t seem to get it working. When I attempt to load the CSS from a directory relative to the template file, it doesn’t load and in the console it reports “Resource interpreted as Stylesheet but transferred with MIME type text/html: “http://localhost:8080/site.css””.

With the default slim-skeleton, everything is loaded relative to the public directory, which I have tried loading relative to that as well, but no luck.

Anybody have any ideas what could be wrong?

Thanks!

I don’t know why, but try adding this to the start of your application.

if (PHP_SAPI === 'cli-server' && $_SERVER['SCRIPT_FILENAME'] !== __FILE__) { return false; }

This should given direct access to files.

Also the link to a resource file must be relative to the public url (http://localhost:8080/), not the template.

If you go directly to http://localhost:8080/site.css you will probably get a not found page, which has MIME type text/html