2014-08-28 43 views
0

我使用作曲家安裝了「autoPrefixer PHP」,並嘗試瞭如github頁面(https://github.com/vladkens/autoprefixer-php)所示的示例。 很簡單的例子autoprefixer PHP不能正常工作,如示例

$autoprefixer = new Autoprefixer(); 
$css  = 'a { transition: transform 1s }'; 
$prefixed = $autoprefixer->compile($css); 

只輸出$ CSS不變。但是,如果我使用自定義參數啓動autprefixer對象,它會輸出正確的前綴css。

$autoprefixer = new Autoprefixer('last 2 versions'); 

還初始化與PARAMATERS對象如圖所示的例子中,給出「未知的瀏覽器要求「IE8」錯誤

$autoprefixer = new Autoprefixer(array('ff > 2', '> 2%', 'ie8')); // many rules 

所以什麼都可以錯在我的安裝?事實上,我沒有手動做任何事情,只是由作曲家安裝。

回答

0

你需要像樣板間 「即」 和 「8」,一個空格:

$autoprefixer = new Autoprefixer(array('ff > 2', '> 2%', 'ie 8')); // many rules 
0

一個快速瀏覽一下vladkens Autoprefixer PHP編譯方法的代碼:

$nodejs = proc_open('node ' . __DIR__ . '/vendor/wrap.js', 
    array(array('pipe', 'r'), array('pipe', 'w')), 
    $pipes 
); 

OK, proc_open節點..它使用Note.js和vladkens自述文件中的介紹他寫道:

此庫提供PHP與N ode.js應用程序。

,並在自述安裝部分,他寫道太

首先,你需要在你的服務器上安裝Node.js的。


它看起來像目前還沒有真正的PHP編譯重建的人沒有自己的服務器,主機託管服務提供商衛生組織支持Note.js,有了這樣的咕嚕/咕嘟咕嘟經驗羅盤或沒有MAC的CodeKit(不錯軟件,以前找到它,但不能直接在Linux上使用它)。

當我的PHP軟件在智能緩存中使用scss,sass,less或其他css PHP修改時,添加autoprefixer也是一個好主意。


結論

你需要你的服務器和權限上的Node.js在PHP執行proc_open()。