File tree Expand file tree Collapse file tree 2 files changed +39
-37
lines changed Expand file tree Collapse file tree 2 files changed +39
-37
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ # css-analyzer-diff
2+
3+ [ ![ NPM Version] ( https://img.shields.io/npm/v/@projectwallace/css-analyzer.svg )] ( https://www.npmjs.com/package/@projectwallace/css-analyzer ) [ ![ Build Status] ( https://travis-ci.org/bartveneman/css-analyzer-diff.svg?branch=master )] ( https://travis-ci.org/bartveneman/css-analyzer-diff ) [ ![ Known Vulnerabilities] ( https://snyk.io/test/github/bartveneman/css-analyzer-diff/badge.svg )] ( https://snyk.io/test/github/bartveneman/css-analyzer-diff ) ![ Dependencies Status] ( https://img.shields.io/david/bartveneman/css-analyzer-diff.svg ) ![ Dependencies Status] ( https://img.shields.io/david/dev/bartveneman/css-analyzer-diff.svg ) [ ![ XO code style] ( https://img.shields.io/badge/code_style-XO-5ed9c7.svg )] ( https://github.com/sindresorhus/xo )
4+
5+ Calculate the difference between two sets of [ CSS stats] ( https://github.com/projectwallace/css-analyzer ) .
6+
7+ ## Usage
8+
9+ ``` js
10+ const differ = require (' css-analyzer-diff' )
11+ const analyzeCss = require (' @projectwallace/css-analyzer' )
12+
13+ const [firstStats , secondStats ] = await Promise .all ([
14+ analyzeCss (' .cat { color: brown; }' ),
15+ analyzeCss (' .cat { color: red; }' )
16+ ])
17+ const changes = differ (firstStats, secondStats)
18+
19+ // => Returns an object with all changes
20+ // {
21+ // 'values.colors.unique': [
22+ // {
23+ // value: 'brown',
24+ // removed: true,
25+ // added: false,
26+ // changed: true
27+ // },
28+ // {
29+ // value: 'red',
30+ // removed: false,
31+ // added: true,
32+ // changed: true
33+ // }
34+ // ],
35+ //
36+ // ... many more ...
37+ //
38+ // }
39+ ```
You can’t perform that action at this time.
0 commit comments