File tree Expand file tree Collapse file tree 1 file changed +37
-2
lines changed
Expand file tree Collapse file tree 1 file changed +37
-2
lines changed Original file line number Diff line number Diff line change 1- # css-analyzer-diff
2- Calculate the difference between two sets of CSS stats
1+ # css-analyzer-diff [ ![ 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 )
2+
3+ Calculate the difference between two sets of [ CSS stats] ( https://github.com/projectwallace/css-analyzer ) .
4+
5+ ## Usage
6+
7+ ``` js
8+ const differ = require (' css-analyzer-diff' );
9+ const analyzeCss = require (' @projectwallace/css-analyzer' );
10+
11+ const [firstStats , secondStats ] = await Promise .all ([
12+ analyzeCss (' .cat { color: brown; }' ),
13+ analyzeCss (' .cat { color: red; }' )]
14+ );
15+ const changes = differ (firstStats, secondStats);
16+
17+ // => Returns a Map with all changes
18+ // Map {
19+ // 'values.colors.unique' => [
20+ // {
21+ // value: 'brown',
22+ // removed: true,
23+ // added: false,
24+ // changed: true
25+ // },
26+ // {
27+ // value: 'red',
28+ // removed: false,
29+ // added: true,
30+ // changed: true
31+ // }
32+ // ],
33+ //
34+ // ... many more ...
35+ //
36+ // }
37+ ```
You can’t perform that action at this time.
0 commit comments