read0more/post-css-module

从json获取postCSS模块的类名

0.1.0 2022-01-27 07:18 UTC

This package is auto-updated.

Last update: 2024-09-27 13:06:32 UTC


README

使用由postCSS-module转换后输出的json文件,获取经过postCSS-module转换的CSS类名。

use PostCSSModule\Transformer;

$cssPath = '/css';
$jsonPathFromPostCSSModule = '/json';
$transformer = new Transformer($cssPath, $jsonPathFromPostCSSModule);

// css filename in $cssPath
$cssName = 'button';
$transformer->getTransformedCssInfo($cssName);

// You can get transformed class name.
// e.g. $transformedClassNames['button'] you can get transformed class name "button"
$transformedClassNames = $transformedCssInfo->classNames;