Skip to content

Commit 35a1b95

Browse files
committed
Update readme with usage notes
1 parent 4b17e5d commit 35a1b95

File tree

1 file changed

+37
-2
lines changed

1 file changed

+37
-2
lines changed

README.md

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,37 @@
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+
```

0 commit comments

Comments
 (0)