.. | ||
dist | ||
CHANGELOG.md | ||
LICENSE.md | ||
package.json | ||
README.md |
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"]
});