I’m attempting to minimize and cache all of our CSS files on our server. I have a script that runs quite well but only works locally and our CSS files are hosted on a CDN. It’s a dynamically generated CSS file and the link to it looks like this:
Each item is a different css file that gets loaded by the php script in the back minimized and cached as appropriate. That all works great but our main site can’t use it. <link href="http://mysite/link" /> doesn’t work as it doesn’t load at all.
I’ve set header types as:
header("Content-Type: text/css; charset: UTF-8");
header('Access-Control-Allow-Origin: *');
And nothing the main site won’t load it. Any ideas how I can fix this?
You should use:
to include style sheets.
<link rel="http://url">is an invalid method to include styles. See also: MDN:<link>