Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
sergei-zelinsky committed Mar 20, 2018
1 parent 2b578d2 commit a644f78
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ module.exports = {
- **registerStyles** - adds styles into internal registry
- **getCriticalCSS** - returns critical stylesheets which has been registered through `registerStyles` previously

```js
new StyleRegistry(<transformFn>);
```

#### Usage
```js
import {StyleRegistry} from 'react-critical-css';
Expand All @@ -115,6 +119,15 @@ const criticalCSS = styleRegistry.getCriticalCSS() // <- retrieve critical CSS

```

```js
const styleRegistry = new StyleRegistry(style => style.replace(/\s/g, ''));

styleRegistry.registerStyles('body { color: red; }')

console.log(styleRegistry.getCriticalCSS()) //-> body{color: red;}
// ...
```

### CriticalCSSProvider [React Component]

Passes context with registerStyles function through the React tree.
Expand Down

0 comments on commit a644f78

Please sign in to comment.