sudofox's journal

Austin Burk's journal, where I share little snippets of my writing, code, and dreams.

Dynamically appending stylesheets for a single-stylesheet environment (Apache, PHP)

Challenge: Flipnote Studio only supports using one external stylesheet link and I don't want to have to modify every stylesheet to add custom styling.

My solution: Execute CSS as PHP!
In the .htaccess for the DSi CSS folder:
<FilesMatch ".css$">
AddType application/x-httpd-php .css
Header set Content-type "text/css"
php_value auto_append_file "/var/www/html/css/ds/sudomemo.css"
Line by line:
"For any file with the .css extension:
1. Execute as PHP
2. Send the "text/css" Content-type so that it is certain to be treated properly as CSS.
3. Append the sudomemo.css file which has extra styles, such as the colors for the notification bar."