如何使用查询字符串链接到服务器生成的CSS文件?

I want to do this:

<link href="/style-render?s=base" rel="stylesheet" type="text/css">

and when I visit /style-render?s=base, it gives me the CSS that I want, but the styles are not being pulled into the page.



It works for google:

<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>

So I know it's possible I just don't know what I'm doing wrong.

I just figured it out.

So since I was using CFML I had to specify the content-type by using a cfcontent tag like so:

<cfcontent type="text/css; charset=utf-8">

in php you would do it like this:

<?php
   header( 'Content-Type: text/css; charset=UTF-8' );
?>

Hope that helps someone!

You need to set a content-type header. Odds are it's rendering as plain/text instead of text/css.

In PHP you'd set your header with:

header('Content-Type: text/css');