@csstools/cascade-layer-name-parser
v2.0.4
Published
Parse CSS Cascade Layer names.
Downloads
5,926,513
Readme
Cascade Layer Name Parser
Usage
Add Cascade Layer Name Parser to your project:
npm install @csstools/cascade-layer-name-parser @csstools/css-parser-algorithms @csstools/css-tokenizer --save-dev
Cascade Layer Name Parser depends on our CSS tokenizer and parser algorithms.
It must be used together with @csstools/css-tokenizer
and @csstools/css-parser-algorithms
.
import { parse } from '@csstools/cascade-layer-name-parser';
const layerNames = parse('layer-name, foo.bar');
layerNames.forEach((layerName) => {
console.log(layerName.name()) // "foo.bar"
console.log(layerName.segments()) // ["foo", "bar"]
});