Let me preface this issue by saying that I'm not sure exactly where the falldown occurs with WKHTMLTOPDF using CSS variables and that I have just fallen back to not using them in the CSS linked to my views that create PDFs so I don't consider this an urgent need by any means.
I have a simple Blade template (laravel, using laravel-snappy) which relies on an external stylesheet. Within this stylesheet I used a single CSS variable similar to this:
Whether you use relative linking or absolute linking to the external file or you use inline CSS WKHTMLTOPDF will not apply the color (or any other directive I would guess) used from the CSS variable.
Nothing too major - Just something I thought might be useful but didn't know if this was a WKHTMLTOPDF issue or a QT issue. I made sure it wasn't an issue with the PHP wrapper I was using by trying the command line version of wkhtmltopdf and the issue persisted.
WebKit is fairly old now, and CSS variables are new and nonstandard (Mozilla-based browsers). As useful as such a feature could be, I would not be surprised if it doesn't work consistently even on Mozilla-based browsers, much less other browsers, or WebKit/wkHTMLtoPDF.
If you want to use variables in your CSS, have you looked at CSS preprocessors such as less?
@PhilterPaper I use SASS with some frequency. This project I was doing was just something small and I read about native CSS variables the other day so I figured I'd give them a try. Just happenstance that I managed to try them out and WKHTMLTOPDF at the same time, guess I'm lucky like that.
Not a big deal if it doesn't work - Just thought I would bring it up to see what the thoughts were on if it could be supported, I don't rely on it to work but someone down the road may really need it. Now there's another Google search result that can come up when people have CSS issues with WKHTMLTOPDF, I know I went through about 3 pages before I figured out what the issue was.