npm.io
3.0.0 • Published 6 months ago

@csstools/cascade-layer-name-parser

Licence
MIT
Version
3.0.0
Deps
0
Size
9 kB
Vulns
0
Weekly
0
Stars
1.1K

Cascade Layer Name Parser for CSS

npm version Build Status Discord

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"]
});

Keywords