-
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: ✏️ Create Getting Started as a separate page
- Loading branch information
Showing
3 changed files
with
62 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
sidebar_position: 2 | ||
sidebar_position: 3 | ||
--- | ||
|
||
# Configuration | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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="" /> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters