JSPM

compare-css

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 10
  • Score
    100M100P100Q28155F
  • License MIT

Tests whether two pieces of CSS text are equivalent in browser

Package Exports

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

Readme

compare-css

Tests whether two pieces of CSS text are equivalent.

Installation

Using npm:

npm install compare-css

Using yarn:

yarn add compare-css

Usage

import isEquivalentCss from "compare-css";

console.log(isEquivalentCss("p { border: 1px; }", "p { border: 2px; }"));
// => false

const css1 = `
  .a {
      color: red;
      height: 100px;
  }
  .b {
      color: red;
      background-color: white;
      height: 30px;
  }
`;

const css2 = `
  .b {
      height: 30px;
      background-color: white;
  }
  .a {
      height: 100px;
  }
  .b,
  .a {
      color: red;
  }
`;

console.log(isEquivalentCss(css1, css2));
// => true