Skip to content

Commit

Permalink
Simplify README
Browse files Browse the repository at this point in the history
  • Loading branch information
revmischa committed Dec 17, 2022
1 parent 0b3f156 commit f2a6107
Showing 1 changed file with 0 additions and 41 deletions.
41 changes: 0 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,50 +17,9 @@ import { Nextjs } from 'cdk-nextjs-standalone';

new Nextjs(this, 'Web', {
nextjsPath: './web', // relative path to nextjs project root

// Bucket that contains your app's images for optimizations.
// If not provided, internal assets bucket will be used.
imageOptimizationBucket: myImageBucket,
});
```

### Image Optimization

All requests to `"/_next/image?url=..." ` will be routed to a separate image optimization lambda. To take advantage of this feature, use the `<Image />` component as:

```ts
// MyPage.tsx
import Image from 'next/image'

function MyPage() {
return (
<>
<Image src="/path/to/image/in/bucket/hello.png" alt={...} width={...} />
<Image src="https://images.unsplash.com/photo-1600804340584-c7db2eacf0bf" alt={...} width={...} />
</>
)
}
```

Note: the `<Image />` component handles the URL encoding and prefixes the `src` with `"/_next/image?url=..."`

If you need to optimize external images, configure `next.config.js`:
(Please see [doc](https://nextjs.org/docs/api-reference/next/image#remote-patterns) on domain patterns.)

```ts
// next.config.js
const nextConfig = {
...
images: {
remotePatterns: [
{
hostname: "**.unsplash.com",
},
],
},
};
```

## Documentation

Available on [Construct Hub](https://constructs.dev/packages/cdk-nextjs-standalone/).
Expand Down

0 comments on commit f2a6107

Please sign in to comment.