10usb/css-lib

该包最新版本(1.0.2)没有提供许可证信息。

CSS 读写库

1.0.2 2017-08-14 20:38 UTC

This package is not auto-updated.

Last update: 2024-09-29 03:57:57 UTC


README

此库允许您解析级联样式表(CSS)文档,您可以查询给定路径的属性值。是否继承值由您决定,这为您创建自己的规则提供了自由。

构造路径是基于堆栈的,因此它很容易在递归过程中实现。例如,遍历DOM结构。

此外,此库还支持通过加载内容并使用新格式重新生成来压缩或重新格式化内容。

示例

$document = new Document();

$parser = new Parser($document->addSegment('style.css')); // could be any name
$parser->setSource(file_get_contents('style.css'));
$parser->parse();


$path = new Path($document, new ExampleTranslator());
$path->push()->setTagName('html');
$path->push()->setTagName('body');
$path->push()->setTagName('section')->addClass('slides');

// prints the height value the section slide would get
echo $path->getValue('height');

待办事项

  • 支持At规则
  • HTML内联的默认示例套件
  • 创建HTMLify格式化器集