mishal/iless-plugin-autoprefix

自动添加CSS前缀的ILess插件

1.1.0 2016-07-19 14:11 UTC

This package is not auto-updated.

Last update: 2024-09-22 07:17:47 UTC


README

使用PostCSS autoprefixer插件自动添加生成的CSS前缀。

构建状态

Build Status

要求

使用此插件,您需要在机器上安装node.js > 0.12

安装

使用Composer安装

$ composer require mishal/iless-plugin-autoprefix

安装要求

$ npm install postcss-cli autoprefixer

查看package.json以获取所需版本。

编程使用

use ILess\Parser;
use ILess\Plugin\Autoprefix\AutoprefixPlugin;

$parser = new Parser();
// register the plugin
$parser->getPluginManager()->addPlugin(new AutoprefixPlugin([
    // see https://github.com/ai/browserslist
    'browsers' => ['last 2 versions']
]));

$parser->parseFile('/example.less');
$css = $parser->getCSS();

Less代码 – Example.less

a {
  display: flex;
}

生成的CSS

a {
  display: -ms-flexbox;
  display: flex;
}