Skip to content

Commit 10c303b

Browse files
committed
Docs: improve readme
1 parent 6c5eb44 commit 10c303b

File tree

2 files changed

+7
-19
lines changed

2 files changed

+7
-19
lines changed

README.md

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ yarn add rename-css-selectors
3030

3131
## Usage
3232

33-
With callbacks:
33+
Async:
34+
35+
> There are 3 different ways of writing async `rcs` code: callbacks, promises and async/await
3436
3537
```js
3638
const rcs = require('rename-css-selectors')
@@ -39,6 +41,7 @@ const rcs = require('rename-css-selectors')
3941
// you can also specify the string although it does not exist yet.
4042
rcs.loadMapping('./renaming_map.json')
4143

44+
// callback
4245
rcs.process.auto(['**/*.js', '**/*.html', '**/*.css'], options, (err) => {
4346
// all css files are now saved, renamed and stored in the selectorLibrary
4447
// also other files are not renamed
@@ -50,27 +53,13 @@ rcs.process.auto(['**/*.js', '**/*.html', '**/*.css'], options, (err) => {
5053
// the mapping file is now saved
5154
});
5255
});
53-
```
54-
55-
With promises:
56-
57-
```js
58-
const rcs = require('rename-css-selectors');
59-
60-
rcs.loadMapping('./renaming_map.json');
6156

57+
// promise
6258
rcs.process.auto(['**/*.js', '**/*.html', '**/*.css'], options)
6359
.then(() => rcs.generateMapping('./', { overwrite: true }))
6460
.catch(console.error);
65-
```
66-
67-
With async/await:
68-
69-
```js
70-
const rcs = require('rename-css-selectors');
71-
72-
rcs.loadMapping('./renaming_map.json');
7361

62+
// async/await
7463
(async () => {
7564
try {
7665
await rcs.process.auto(['**/*.js', '**/*.html', '**/*.css'], options);
@@ -81,7 +70,6 @@ rcs.loadMapping('./renaming_map.json');
8170
})();
8271
```
8372

84-
8573
Sync:
8674

8775
```js
@@ -106,7 +94,7 @@ try {
10694
- [rcs.process.any](docs/api/processAny.md)
10795
- [rcs.generateMapping](docs/api/generateMapping.md)
10896
- [rcs.loadMapping](docs/api/loadMapping.md)
109-
- [rcs.includeConfig](docs/api/includeconfig.md)
97+
- [rcs.includeConfig](docs/api/includeConfig.md)
11098

11199
# LICENSE
112100

File renamed without changes.

0 commit comments

Comments
 (0)