OK, so I’m trying to get this PHP CSS variable thing set up. I have it working on my local machine, but so far no dice on the actual server. Basically this is a trick described here: How to Add Variables to Your CSS Files | Envato Tuts+ that allows me to use PHP variables in my css. To get it working on my local machine (via MAMP), I added
<?php header("Content-type: text/css"); ?>
to the top of each CSS doc, including panel stuff, and added
to the .htacess file. This works on MAMP, any tips on getting this to work on the server? (also, I’m only assuming this is what’s breaking the site, as everything but the css seems to be working)
If you actually want to generate dynamic CSS right on the server in real-time (and only then), you can use a Kirby route that sets the content-type header to CSS and outputs your dynamic CSS.
Otherwise using a preprocessor is way better and way faster because it saves a lot of time when the CSS file is requested (as it doesn’t have to be generated in real-time). The article you linked to is from 2009, and a lot has changed since then.
The preprocessor only compiles file not starting with an underscore. I use the great CodeKit to do all the compiling in automatically in the background.
I’ve gotten sass up and running using the terminal! I used http://sebastianpontow.de/css2compass/ to get started (I already had a site approaching completion).
It was a simple task to replace the php variables I had with sass variables.
I took a look at codeKit and it’s not quite my style, but looks like a good tool.
I have a lot of fields in the panel that style the page dynamic.
To access the $page object i need to put in a snippet right !?
So I have a snippet file called style.php.
Now I am just :