Split from: http://drupal.org/node/763730#comment-3218038
any news on this? -webkit-* -moz-* stuff gets thrown out when running thru csstidy. like gradient/border radius et al. or is there a way to "preserve" certain portions of a stylesheet from being optimized?
Comments
Comment #1
philbar commentedSince these CSS elements aren't standard and many will likely be replaced by CSS3, I'm not going to be able to spend much time on it. Also, this is a issue that belongs upstream at the official project: http://csstidy.sourceforge.net/
I do welcome patches though, if someone else wants to figure out a solution.
Comment #2
Anonymous (not verified) commentedUnderstandable!
What about implementing a comment tag to prevent csstidy from optimising portions of a stylesheet? I haven't been able to find anything via google on this. :(
Easiest form of this would be something like
But looking through the source of the csstidy class, this might get very complicated. :-( Also, adding "quirky" comments and styles to a CSS file and then optimizing it using a parser like CSSTidy is a little bit schizophrenic, but with all the browsers being "complicated" and slightly "impaired" even ... :-) Oh my.
Also, I came across Yahoo's CSS minifier, a JAVA CLI tool. There's also a PHP class for that. But no module yet for Drupal. *hint hint* :-)
Comment #3
philbar commentedYou could probably add the following to the
csstidy/data.inc.phpafter:It's a hack...but it should work. You just have to trick CSSTidy into thinking those are valid CSS elements.
Comment #4
philbar commentedComment #5
Anonymous (not verified) commentedThanks for the investigation :D
It's possible to tweak it for these properties (tested). While -moz-border-radius is already not being rejected without the "hack", I don't see currently a way to make this work for gradients. Gradients are being specified as values of the background property and are being "thrown out" because there is no whitelist for values of the given syntax. Hacking this would most probably need some more advanced changes.
I think the best we can do for now is to wait for an updated csstidy library aswell as vendors implementing official CSS3 properties. In my case, the size difference of gzipped tidy css and gzipped regular/aggregated css is not really a game killer, so I'll just turn csstidy off for now and leave it to Apache to gzip css files on the fly and cache the stuff via mod_disk_cache.
Comment #6
philbar commentedHere is a hack that supposedly works for gradients:
http://drupal.org/node/763730#comment-3227172
Comment #7
philbar commentedCan you tell me if it works as follows?
If not try:
If those work, I'll add it to the module.
The setting that removes invalid CSS is turned off, so it shouldn't matter what is in the CSS version part of the string.
Comment #8
philbar commentedFor reference:
https://developer.mozilla.org/en/CSS_Reference/Mozilla_Extensions
Still looking for a reputable source for webkit properties.
Comment #9
philbar commentedComment #10
philbar commentedhttp://drupal.org/cvs?commit=432558
Added all properties contained in the following sources:
- https://developer.mozilla.org/en/CSS_Reference/Mozilla_Extensions
- http://css-infos.net/properties/webkit.php