From 9d37e872f47e09306111bb849216d45e421f34e0 Mon Sep 17 00:00:00 2001 From: dc7290 Date: Fri, 20 May 2022 03:01:13 +0900 Subject: [PATCH] =?UTF-8?q?docs:=20=E2=9C=8F=EF=B8=8F=20Create=20Getting?= =?UTF-8?q?=20Started=20as=20a=20separate=20page?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/docs/configuration.md | 2 +- docs/docs/getting-started.md | 61 ++++++++++++++++++++++++++++++++++++ docs/docs/intro.md | 58 ---------------------------------- 3 files changed, 62 insertions(+), 59 deletions(-) create mode 100644 docs/docs/getting-started.md diff --git a/docs/docs/configuration.md b/docs/docs/configuration.md index 7f1916c7..2c84dd9b 100644 --- a/docs/docs/configuration.md +++ b/docs/docs/configuration.md @@ -1,5 +1,5 @@ --- -sidebar_position: 2 +sidebar_position: 3 --- # Configuration diff --git a/docs/docs/getting-started.md b/docs/docs/getting-started.md new file mode 100644 index 00000000..3195157c --- /dev/null +++ b/docs/docs/getting-started.md @@ -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 + +// Or import as follows + +``` diff --git a/docs/docs/intro.md b/docs/docs/intro.md index 6161456e..47bb41a3 100644 --- a/docs/docs/intro.md +++ b/docs/docs/intro.md @@ -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 - -// Or import as follows - -```