我需要一些幫助編寫一個真棒類來採取樣式表,檢測瀏覽器特定的CSS3規則,並添加對所有兼容瀏覽器的支持。這樣,我們只需爲一個瀏覽器編寫樣式表,然後在準備生產時處理CSS文件。PHP類重寫CSS3規則的跨瀏覽器兼容性
下面是對類我的想法至今:
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)
}
}
你的問題是什麼?我們不會爲你寫東西,你知道...... – 2010-09-24 03:21:46
@Michael Petrotta--他要求人們爲他寫的(5美元的現金獎勵),但這是自編輯出來的。 – Matchu 2010-09-24 03:23:46
啊。柯克,既然你問了,不,這在SO上是不合適的。自己點一下,如果你在任何地方掛了,就問問題。我認爲這有點雄心勃勃,但是,這可能是一次很好的學習經歷。我建議遠離正則表達式 - 它會變得非常複雜,非常快。 – 2010-09-24 03:25:58