cjmarkham/css-compiler

Silex 的 CSS 编译器

dev-master 2013-05-10 19:03 UTC

This package is not auto-updated.

Last update: 2024-09-23 13:59:16 UTC


README

为 silex 编写的 css 编译器

注册

在 composer.json 中添加以下依赖项

"cjmarkham/css-compiler": "dev-master"

然后进行注册

$app->register(new CssCompiler\CompilerServiceProvider());

选项

  • compiler.shorten_hex - 缩短十六进制值。默认 false
  • compiler.short_values - 缩短值。例如,将 margin:10px 0 10px 0 缩短为 margin:10px 0。默认 true
  • compiler.remove_empty - 删除空规则。默认 false
  • compiler.remove_units - 删除不必要的单位。例如,将 0px 缩短为 0。默认 true
  • compiler.rgb_to_hex - 将 rgb 值转换为十六进制值。默认 false
  • compiler.input_dir - 包含您的 CSS 的目录。 必需
  • compiler.output_path - 保存编译后的 CSS 的路径。默认 compiler.input_dir / compiled.css

使用方法

$app->register(new CssCompiler\CompilerServiceProvider(), array(
    'compiler.shorten_hex' => true,
    'compiler.rgb_to_hex' => true,
    'compiler.remove_empty' => true,
    'compiler.input_dir' => __DIR__ . '/css',
    'compiler.output_path' => __DIR__ . '/css/compiled.css'
));

$app['compiler']->compile();