Skip to content

Commit 267bde8

Browse files
committed
feat: 1.2.0
1 parent 73e3a4c commit 267bde8

File tree

80 files changed

+6742
-5648
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+6742
-5648
lines changed

.appveyor.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
environment:
22
matrix:
3-
- nodejs_version: "10"
4-
- nodejs_version: "11"
3+
# - nodejs_version: "10"
4+
# - nodejs_version: "11"
55
- nodejs_version: "12"
66
- nodejs_version: "13"
77
- nodejs_version: "14"
88
- nodejs_version: "15"
9-
# - nodejs_version: "16"
9+
- nodejs_version: "16"
1010

1111
platform:
1212
- x64

.travis.yml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
language: node_js
22
os: linux
33
dist: xenial
4+
install: yarn install --frozen-lockfile --ignore-engines
45
before_script: yarn build
56
jobs:
67
include:
7-
- name: Node 10
8-
node_js: 10
9-
- name: Node 11
10-
node_js: 11
11-
install: yarn install --frozen-lockfile --ignore-engines
8+
# - name: Node 10
9+
# node_js: 10
10+
# before_script: yarn build:src
11+
# - name: Node 11
12+
# node_js: 11
13+
# before_script: yarn build:src
1214
- name: Node 12
1315
node_js: 12
1416
- name: Node 13
@@ -17,13 +19,14 @@ jobs:
1719
node_js: 14
1820
- name: Node 15
1921
node_js: 15
20-
# - name: Node 16
21-
# node_js: 16
22-
# - name: Latest Node - Windows
23-
# node_js: node
24-
# os: windows
22+
- name: Node 16
23+
node_js: 16
24+
# - name: Latest Node - Windows
25+
# node_js: node
26+
# os: windows
2527
- name: Latest Node - OSX
2628
node_js: node
29+
before_install: npm install -g yarn
2730
os: osx
2831
- name: Latest Node - Linux
2932
node_js: node

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright 2020 Yaroslav Vorobev and contributors. All rights reserved.
1+
Copyright 2020-2022 Yaroslav Vorobev and contributors. All rights reserved.
22

33
Permission to use, copy, modify, and/or distribute this software for any
44
purpose with or without fee is hereby granted, provided that the above

ReadMe.md

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55

66
Generating CSS patches (just like a diff).
77

8-
## Reasons to use
8+
## Use cases
99

1010
### Themes generation
1111

12-
The easiest way to make a new theme is just copy the file and change some stuff
13-
or if you use preprocessor (such as SCSS, Less, etc.) you can just change some
14-
variables and get a new style.
12+
The easiest way to make a new theme is to copy the file and change some stuff
13+
or, if you use a preprocessor (such as SCSS, Less, etc.), change some
14+
variables and get a new stylesheet.
1515

16-
But serving files with big amount of literally the same code is not a good idea,
17-
so this is when css-patch can help you.
16+
But serving files with big amount of the same code is not a good idea, so this
17+
is when css-patch can help you.
1818

1919
You can pass 2 stylesheets (`original`/`base` and `expected`) to `generateCSSPatch`
2020
and get a new stylesheet. This new stylesheet is intended to be applied after
@@ -24,9 +24,9 @@ the `original` one.
2424

2525
### Extracting difference
2626

27-
Imagine if you have two versions of the same CSS.
27+
Imagine that you have two versions of the same CSS stylesheet.
2828

29-
You can use this module to get the "difference" between them.
29+
By using this module you can get the difference between them.
3030

3131
## Install
3232

@@ -46,26 +46,26 @@ npm i css-patch
4646

4747
[Read the docs on GitHub pages.](https://zekfad.github.io/css-patch/)
4848

49-
For advanced usage see the docs for [`transformCSS`](https://zekfad.github.io/css-patch/global.html#transformCSS) function and [`CSSTransformerBase`](https://zekfad.github.io/css-patch/CSSTransformerBase.html) class.
49+
For advanced usage see the docs for [`transformCSS`](https://zekfad.github.io/css-patch/global.html#transformCSS) function and [`CSSTransformerBase`](https://zekfad.github.io/css-patch/CSSTransformers.CSSTransformerBase.html) class.
5050

5151
## Possible caveats
5252

53-
### `unset`
53+
### `unset`
5454

55-
If something existed in `original` stylesheet missing in `expected` one,
56-
will result of being transformed to `<something>: unset;`.
55+
Declarations missing in `expected` stylesheet, but present in `original` one,
56+
will be set to `unset`.
5757

5858
### Combined rule orders
5959

60-
Logically the same but with a different order combined rules (e.g. `.a,.b` and `.b,.a`)
60+
Logically the same but with a different order combined rules (e.g.`.a,.b` and `.b,.a`)
6161
will be considered as a different rules.
6262

6363
### Merged rules
6464

65-
If rules have exact the same name their declarations would be merged (later appeared
66-
declarations will be a higher priority).
65+
Rules with the same name will have their declarations merged with each other,
66+
overriding previous declarations in the order they appear.
6767

68-
For example `.a{a:1;c:3;}.a{a:2;b:2;}` will be threat as `.a{a:2;b:2;c;3}`.
68+
For example `.a{a:1;c:3;}.a{a:2;b:2;}` will be treated as `.a{a:2;b:2;c;3}`.
6969

7070
### Sorting
7171

@@ -91,9 +91,16 @@ import { generateCSSPatch, } from 'css-patch';
9191

9292
```js
9393
console.log(
94-
generateCSSPatch(
95-
'a{a:1;b:1;}b{b:1;}c{a:1;}d{a:1;}',
96-
'a{a:1;}b{b:2;}c{a:1;}'
94+
generateCSSPatch(`
95+
a { same: value; missing: value; }
96+
b { different: original_value; }
97+
c { same: rule; }
98+
missing_rule { missing: value; }
99+
`, `
100+
a { same: value; }
101+
b { different: new_value; }
102+
c { same: rule; }
103+
`
97104
)
98-
); // 'a{b:unset;}b{b:2;}d{a:unset;}'
105+
); // 'a{missing:unset;}b{different:new_value;}missing_rule{missing:unset;}'
99106
```

0 commit comments

Comments
 (0)