netzmacht / assetic-autoprefixer
此软件包已被废弃,不再维护。没有建议的替代软件包。
用于kriswallsmith/assetic的autoprefixer-php过滤器
dev-master / 1.0.x-dev
2015-03-19 16:50 UTC
Requires
- php: >=5.3
- kriswallsmith/assetic: 1.*
Requires (Dev)
- phpmd/phpmd: ~2.0
- phpunit/phpunit: ~3.7
- squizlabs/php_codesniffer: ~1.0
Replaces
- bit3/assetic-autoprefixer: dev-master
This package is not auto-updated.
Last update: 2020-01-24 15:33:31 UTC
README
Autoprefixer过滤器
这是一个用于在Autoprefixer和PHP assetic框架中使用的过滤器实现。
要求
在您的php项目中需要安装kriswallsmith/assetic
。在您的系统上需要安装postcss/autoprefixer
。
使用composer安装kriswallsmith/assetic
php composer.phar require kriswallsmith/assetic ~1.0
在您的系统上全局安装autoprefixer
sudo npm install -g autoprefixer
在您的系统上本地安装autoprefixer
npm install autoprefixer
PHP中的使用
use Bit3\Assetic\Filter\Autoprefixer\AutoprefixerFilter; // if you have installed autoprefixer globally $autoprefixerBinary = '/usr/bin/autoprefixer'; // if you have installed autoprefixer locally $autoprefixerBinary = '/../node_modules/.bin/autoprefixer'; $autoprefixerFilter = new AutoprefixerFilter($autoprefixerBinary); // if node.js binary is not installed as /usr/bin/node // (e.g. on debian/ubuntu the binary is named /usr/bin/nodejs) $autoprefixerFilter->setNodeBin('/usr/bin/nodejs');
Symfony2中的使用
此项目包含一个位于config
目录中的assetic过滤器配置文件。
在parameters.yml
中定义autoprefixer的二进制路径
parameters: # if you have installed autoprefixer globally assetic.autoprefixer.bin: /usr/bin/autoprefixer # if you have installed autoprefixer locally assetic.autoprefixer.bin: %kernel.root_dir%/../node_modules/.bin/autoprefixer # if node.js binary is not installed as /usr/bin/node # (e.g. on debian/ubuntu the binary is named /usr/bin/nodejs) assetic.node.bin: /usr/bin/nodejs
然后在assetic
配置章节中启用过滤器
# Assetic Configuration assetic: filters: autoprefixer: resource: "%kernel.root_dir%/../vendor/netzmacht/assetic-autoprefixer/config/autoprefixer.xml" # if you like, you can use apply_to here :-) # e.g, apply_to: "\.css" # otherwise you use the filter in your template with filter="autoprefixer"