JSPM

sort-specificity

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q25090F
  • License ISC

Sort CSS specificity

Package Exports

  • sort-specificity

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 (sort-specificity) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Sort Specificity

Sort css selector for specificity

NPM npm version Build Status

Instalation

npm install sort-specificity

Usage

var sortSpecificity = require('sort-specificity')
var input = [
  "a .d b#foo",
  "b",
  "a .d b.d",
  "a b",
  "a .d b",
]
var result = sortSpecificity(input)

result is

[
  "a .d b#foo",
  "a .d b.d",
  "a .d b",
  "a b",
  "b"
]

Input raw css

You can input raw css.

var css = fs.readFileSync("./fixtures/sample.css", "utf-8")
var result = sortSpecificity(css) // parsed css selctor