Skip to content

Commit

Permalink
docs: ✏️ Create Getting Started as a separate page
Browse files Browse the repository at this point in the history
  • Loading branch information
dc7290 committed May 19, 2022
1 parent 7af96e2 commit 9d37e87
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 59 deletions.
2 changes: 1 addition & 1 deletion docs/docs/configuration.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
sidebar_position: 2
sidebar_position: 3
---

# Configuration
Expand Down
61 changes: 61 additions & 0 deletions docs/docs/getting-started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
sidebar_position: 2
---

# Getting Started

Install the package in the project that uses Next.js.

## Installation

```bash
yarn add -D next-export-optimize-images
```

## Usage

1. Write withExportImages in `next.config.js.`

```js
// next.config.js
const withExportImages = require('next-export-optimize-images')

module.exports = withExportImages({
// write your next.js configuration values.
})
```

If you are using `next-compose-plugins`

```js
// next.config.js
const withPlugins = require('next-compose-plugins')
const withExportImages = require('next-export-optimize-images')

module.exports = withPlugins(
[
withExportImages,
// your other plugins here
],
{
// write your next.js configuration values.
}
)
```

2. Change the description of the `scripts` that do the `next export` in `package.json`

```
{
- "export": "next build && next export",
+ "export": "next build && next export && next-export-optimize-images",
}
```

3. Import and use next/image as usual.

```jsx
<Image src="/images/img.png" width={1920} height={1280} alt="" />
// Or import as follows
<Image src={require('./img.png')} alt="" />
```
58 changes: 0 additions & 58 deletions docs/docs/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,61 +22,3 @@ This makes it possible to build a high performance website with this solution, w
- Using `sharp`, so it's fast.
- Cache prevents repeating the same optimization
- Support TypeScript

## Getting Started

Install the package in the project that uses Next.js.

### Installation

```bash
yarn add -D next-export-optimize-images
```

### Usage

1. Write withExportImages in `next.config.js.`

```js
// next.config.js
const withExportImages = require('next-export-optimize-images')

module.exports = withExportImages({
// write your next.js configuration values.
})
```

If you are using `next-compose-plugins`

```js
// next.config.js
const withPlugins = require('next-compose-plugins')
const withExportImages = require('next-export-optimize-images')

module.exports = withPlugins(
[
withExportImages,
// your other plugins here
],
{
// write your next.js configuration values.
}
)
```

2. Change the description of the `scripts` that do the `next export` in `package.json`

```
{
- "export": "next build && next export",
+ "export": "next build && next export && next-export-optimize-images",
}
```

3. Import and use next/image as usual.

```jsx
<Image src="/images/img.png" width={1920} height={1280} alt="" />
// Or import as follows
<Image src={require('./img.png')} alt="" />
```

0 comments on commit 9d37e87

Please sign in to comment.