Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
bezoerb authored Sep 6, 2022
1 parent d64bb6b commit 4749fb3
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ npm i -D critical
Include:

```js
const critical = require('critical');
import {generate} from 'critical';
```

Full blown example with available options:

```js
critical.generate({
generate({
// Inline the generated critical-path CSS
// - true generates HTML
// - false generates CSS
Expand Down Expand Up @@ -83,7 +83,7 @@ critical.generate({
Basic usage:

```js
critical.generate({
generate({
inline: true,
base: 'test/',
src: 'index.html',
Expand All @@ -98,7 +98,7 @@ critical.generate({
Basic usage:

```js
critical.generate({
generate({
base: 'test/',
src: 'index.html',
target: 'styles/main.css',
Expand All @@ -110,7 +110,7 @@ critical.generate({
Generate and minify critical-path CSS:

```js
critical.generate({
generate({
base: 'test/',
src: 'index.html',
target: 'styles/styles.min.css',
Expand All @@ -122,7 +122,7 @@ critical.generate({
Generate, minify and inline critical-path CSS:

```js
critical.generate({
generate({
inline: true,
base: 'test/',
src: 'index.html',
Expand All @@ -138,7 +138,7 @@ critical.generate({
Generate and return output via callback:

```js
critical.generate({
generate({
base: 'test/',
src: 'index.html',
width: 1300,
Expand All @@ -154,7 +154,7 @@ critical.generate({
Generate and return output via promise:

```js
critical.generate({
generate({
base: 'test/',
src: 'index.html',
width: 1300,
Expand All @@ -171,7 +171,7 @@ critical.generate({
Generate and return output via async function:

```js
const {css, html, uncritical} = await critical.generate({
const {css, html, uncritical} = await generate({
base: 'test/',
src: 'index.html',
width: 1300,
Expand All @@ -185,7 +185,7 @@ When your site is adaptive and you want to deliver critical CSS for multiple scr
_note:_ (your final output will be minified as to eliminate duplicate rule inclusion)

```js
critical.generate({
generate({
base: 'test/',
src: 'index.html',
target: {
Expand All @@ -209,7 +209,7 @@ critical.generate({
This is a useful option when you e.g. want to defer loading of webfonts or background images.

```js
critical.generate({
generate({
base: 'test/',
src: 'index.html',
target: {
Expand All @@ -225,7 +225,7 @@ critical.generate({
### Generate critical-path CSS and specify asset rebase behaviour

```js
critical.generate({
generate({
base: 'test/',
src: 'index.html',
target: {
Expand All @@ -239,7 +239,7 @@ critical.generate({
```

```js
critical.generate({
generate({
base: 'test/',
src: 'index.html',
target: {
Expand Down Expand Up @@ -302,9 +302,9 @@ critical test/fixture/index.html --base test/fixture > critical.css
## Gulp

```js
const gulp = require('gulp');
const log = require('fancy-log');
const critical = require('critical').stream;
import gulp from 'gulp';
import log from 'fancy-log';
import {stream as critical} from 'critical';

// Generate & Inline Critical-path CSS
gulp.task('critical', () => {
Expand Down

0 comments on commit 4749fb3

Please sign in to comment.