Package Exports
- @bramus/specificity
- @bramus/specificity/dist/index.cjs.js
- @bramus/specificity/dist/index.esm.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@bramus/specificity) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Specificity
Calculate the Specificity of a given CSS Selector
Installation
npm i @bramus/specificityUsage / Example
This library comes as an ES Module and exposes a calculate function which calculates the specificity of a given CSS selector.
import { calculate } from '@bramus/specificity';
const specificity = calculate('.foo :is(.bar, #baz)');
// ~> { a: 1, b: 1, c: 0 }License
@bramus/specificity is released under the MIT public license. See the enclosed LICENSE for details.
Acknowledgements
The code was sparked by the wonderful Specificity Calculator created by Kilian Valkhof / Polypane.
The heavy lifting of doing the actual parsing is done by CSSTree.