Okay, So I've googled a couple of pages and come up with the following solution:
Add this in .htaccess#Active GZIP for php-files
php_flag zlib.output_compression On
php_value zlib.output_compression_level 5
and this for .js and .css:
AddHandler application/x-httpd-php .css .js
php_value auto_prepend_file /Library/WebServer/Documents/blog/code/Helpers/ContentHeader.php
Which will execute .js as well as .css as php scripts. The second row includes the following page:
<?php
$pathInfo = pathinfo($_SERVER['PHP_SELF']);
$extension = $pathInfo['extension'];
if($extension == "css")
{
header("Content-type: text/css");
}
if($extension == "js")
{
header("Content-type: text/javascript");
}
?>
Which will send header "text/css" to .css files and "text/javascript" to javascript files. So far so good. The problem however is with a couple of minified javascripts that I use I get some kind of php error:
<br />
<b>Parse error</b>: syntax error, unexpected ']' in <b>/Library/WebServer/Documents/blog/public/scripts/prettify/prettify.js</b> on line <b>18</b><br />
or:
<br />
<b>Warning</b>: Unexpected character in input: '\' (ASCII=92) state=1 in <b>/Library/WebServer/Documents/blog/public/scripts/showdown.js</b> on line <b>29</b><br />
<br />
<b>Parse error</b>: syntax error, unexpected '?' in <b>/Library/WebServer/Documents/blog/public/scripts/showdown.js</b> on line <b>29</b><br />
So, is there any better way of doing this? The only option I can come up with is to manually go in to the .javascript files and "correct the errors" that php doesn't like. But shouldn't it be a easier solution?