I renamed my stylesheet as full.css.php
and on the very beginning of the file i wrote this code:
<?php
header("Content-type: text/css; charset: UTF-8");
//here I want to set all my css variables
$font_color = '#ccf';
?>
//here starts the css
body{
color: <?php echo $font_color?>;
}
The browser is giving me this: Resource interpreted as Script but transferred with MIME type text/css: "http://localhost/root/_Viewer/css/full.css.php".
.
And then error: "Uncaught SyntaxError: Unexpected token {" (this is the first brace from body css declaration).
If I look in source, I find that my file was sent as application/javascript
file, not as text/css
:
<script type='application/javascript' src='_Viewer/css/full.css.php'></script>
I know dynamic CSS won't be cached, but it's fine with me. It's more important now to have some settings easy to access. Need help to fix this.
Btw: I'm running this under XAMPP !
-i forgot to mention: i'm doing similar with one of my js files and it's working just fine ( header("Content-type: application/javascript");
)