PHP Class to Rewrite CSS3 Rules for Cross Browser Compatibility

Hambil

New Member
I need some help writing an awesome class to take a style sheet, detect browser specific CSS3 rules, and add support for all compatible browsers. This way, we can just write our styles sheets for one browser and then process the CSS files when we are ready for production.Here's my thoughts on the class so far:\[code\]class CssRewriter { public function reformCss($file) { // Get the CSS as a string $cssString = file_get_contents($file); // Use regex to capture all styles delimited by {...} // Use regex to determine if the any of the captured styles are browser // specific (starts with -moz, -webkit, etc) // Determine which CSS3 rules are not present and add them to the style // (so if you have -moz-linear-gradient, automatically add the webkit // version) }}\[/code\]
 
Back
Top