Skip to content

Commit

Permalink
Docs: update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
JPeer264 committed Feb 13, 2020
1 parent 2e3e8c2 commit 7876206
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
25 changes: 25 additions & 0 deletions README.md
Expand Up @@ -23,6 +23,31 @@ or
$ yarn add rcs-core
```

## Example

1. Fill your library with all selectors (we assume there is just one CSS file)

```js
rcs.fillLibraries(fs.readFileSync('./src/styles.css', 'utf8'));

// excluding specific selectors
rcs.selectorsLibrary.setExclude('selector-to-ignore');
```

2. Rewrite all files

> **Note:** Do not forget to replace your CSS file
```js
const css = rcs.replace.css(fs.readFileSync('./src/styles.css', 'utf8'));
const js = rcs.replace.js(fs.readFileSync('./src/App.js', 'utf8'));
const html = rcs.replace.html(fs.readFileSync('./src/index.html', 'utf8'));

fs.writeFileSync('./dist/styles.css', css);
fs.writeFileSync('./dist/App.js', js);
fs.writeFileSync('./dist/index.html', html);
```

## API documentation
- [rcs.stats](docs/api/stats.md)
- [rcs.replace](docs/api/replace.md)
Expand Down
6 changes: 3 additions & 3 deletions docs/api/baselibrary.md
Expand Up @@ -134,7 +134,7 @@ Example:
const rcs = require('rcs-core');

rcs.baseLibrary.setReserved('a'); // or:
rcs.baseLibrary.setReserved(['a', 'b']);
rcs.baseLibrary.setReserved(['a', 'b']);

// the value will not be mapped to either 'a' or 'b'
rcs.baseLibrary.set('something');
Expand Down Expand Up @@ -175,7 +175,7 @@ Example:
```js
const rcs = require('rcs-core');

rcs.baseLibrary.setPrefix('lib-');
rcs.baseLibrary.setPrefix('lib-');
rcs.baseLibrary.set('my-id'); // sets to 'lib-a'

rcs.baseLibrary.get('my-id'); // 'lib-a'
Expand All @@ -195,7 +195,7 @@ Example:
```js
const rcs = require('rcs-core');

rcs.baseLibrary.setSuffix('-bad');
rcs.baseLibrary.setSuffix('-bad');
rcs.baseLibrary.set('my-id'); // sets to 'a-bad'

rcs.baseLibrary.get('my-id'); // 'a-bad'
Expand Down
2 changes: 1 addition & 1 deletion docs/api/filllibraries.md
@@ -1,6 +1,6 @@
# rcs.fillLibraries

> This fills `selectorLibrary` and `keyframesLibrary` with all necessary information. Just put in your CSS code.
> This fills `selectorLibrary`, `keyframesLibrary` and `cssVariablesLibrary` with all necessary information. Just put in your CSS code.
> **Note:** Put your stylesheets in here before you call any [rcs.replace](replace.md) method.
Expand Down

0 comments on commit 7876206

Please sign in to comment.