Skip to content

Commit

Permalink
docs(website): document extra attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
gregberge committed Jan 22, 2019
1 parent 8a3d067 commit 6d8f1d2
Showing 1 changed file with 36 additions and 8 deletions.
44 changes: 36 additions & 8 deletions website/src/pages/docs/api-loadable-server.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ const app = <App />

Get scripts as a string of `<script>` tags.

| Arguments | Description |
| ------------ | ----------------------------------------- |
| `attributes` | Optional attributes added to script tags. |

```js
const body = `<body><div id="root">${html}</div>${chunkExtractor.getScriptTags()}</body>`
```
Expand All @@ -66,6 +70,10 @@ const body = `<body><div id="root">${html}</div>${chunkExtractor.getScriptTags()

Get scripts as an array of React `<script>` elements.

| Arguments | Description |
| ------------ | --------------------------------------------- |
| `attributes` | Optional attributes added to script elements. |

```js
const body = renderToString(
<body>
Expand All @@ -79,6 +87,10 @@ const body = renderToString(

Get "prefetch" and "preload" links as a string of `<link>` tags.

| Arguments | Description |
| ------------ | --------------------------------------- |
| `attributes` | Optional attributes added to link tags. |

```js
const head = `<head>${chunkExtractor.getLinkTags()}</head>`
```
Expand All @@ -87,6 +99,10 @@ const head = `<head>${chunkExtractor.getLinkTags()}</head>`

Get "prefetch" and "preload" links as an array of React `<link>` elements.

| Arguments | Description |
| ------------ | ------------------------------------------- |
| `attributes` | Optional attributes added to link elements. |

```js
const head = renderToString(<head>{chunkExtractor.getLinkElements()}</head>)
```
Expand All @@ -95,33 +111,45 @@ const head = renderToString(<head>{chunkExtractor.getLinkElements()}</head>)

Get style links as a string of `<link>` tags.

| Arguments | Description |
| ------------ | ---------------------------------------- |
| `attributes` | Optional attributes added to style tags. |

```js
const head = `<head>${chunkExtractor.getStyleTags()}</head>`
```

## chunkExtractor.getStyleElements

Get style links as an array of React `<link>` elements.

```js
const head = renderToString(<head>{chunkExtractor.getStyleElements()}</head>)
```

## chunkExtractor.getInlineStyleTags

Get inline style links as a string of `<link>` tags (returns a promise).

| Arguments | Description |
| ------------ | ---------------------------------------- |
| `attributes` | Optional attributes added to style tags. |

```js
chunkExtractor.getInlineStyleTags()
.then((styleTags) => {
const head = `<head>${styleTags}</head>`
}
```
## chunkExtractor.getStyleElements
Get style links as an array of React `<link>` elements.
```js
const head = renderToString(<head>{chunkExtractor.getStyleElements()}</head>)
```
## chunkExtractor.getInlineStyleElements
Get inline style links as an array of React `<link>` elements (returns a promise).
| Arguments | Description |
| ------------ | -------------------------------------------- |
| `attributes` | Optional attributes added to style elements. |
```js
chunkExtractor.getInlineStyleElements()
.then((styleElements) => {
Expand Down

0 comments on commit 6d8f1d2

Please sign in to comment.