Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/247.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
autoprefixer PHP未按示例所示工作_Php_Css_Autoprefixer - Fatal编程技术网

autoprefixer PHP未按示例所示工作

autoprefixer PHP未按示例所示工作,php,css,autoprefixer,Php,Css,Autoprefixer,我使用composer安装了“autoPrefixer PHP”,并尝试了github页面()中所示的示例。 非常简单的例子 $autoprefixer = new Autoprefixer(); $css = 'a { transition: transform 1s }'; $prefixed = $autoprefixer->compile($css); 只输出$css不变。但是,如果我使用自定义参数初始化AUTPRIFIXER对象,它将正确输出带前缀的css $auto

我使用composer安装了“autoPrefixer PHP”,并尝试了github页面()中所示的示例。 非常简单的例子

$autoprefixer = new Autoprefixer();
$css      = 'a { transition: transform 1s }';
$prefixed = $autoprefixer->compile($css);
只输出$css不变。但是,如果我使用自定义参数初始化AUTPRIFIXER对象,它将正确输出带前缀的css

$autoprefixer = new Autoprefixer('last 2 versions');
如示例所示,同样使用参数初始化对象,会出现“未知浏览器要求'ie8'”错误

那么,我的安装有什么问题?事实上,我没有手动执行任何操作,只是由composer安装。

在“ie”和“8”之间需要一个空格,如示例所示:

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

快速查看编译方法的代码:

$nodejs = proc_open('node ' . __DIR__ . '/vendor/wrap.js',
    array(array('pipe', 'r'), array('pipe', 'w')),
    $pipes
);
好的,proc_open node..,它使用Note.js,他在vladkens自述介绍中写道:

该库提供了与Node.js应用程序的PHP集成

在自述文件安装部分,他也写了它

首先,您需要在服务器中安装Node.js


看起来目前还没有真正的PHP重建编译器可供那些没有自己的服务器、hoster whos support Note.js、在Grunt/Gulp上有类似Compass或NoMac for的经验的人使用(很好的软件,以前找到过,但无法在linux上直接使用)

当我的PHP软件使用SCS、sass、less或其他带有智能缓存的css PHP修改时,添加autoprefixer也是一个好主意


结论

您需要服务器上的Node.js以及在PHP中执行proc_open()的权限

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