Skip to content

Commit

Permalink
Added option to prerender images without calling ImageRequestHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
luca-vogels committed Jan 27, 2024
1 parent 5f90b60 commit 560806a
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,21 @@ To work with NextJS you need to add the following to your `next.config.js`:
experimental: {
serverComponentsExternalPackages: ["sharp"],
}
```
```


## Prerender Images before Deployment
Images can also be prerendered before deployment e.g. inside of a CI/CD pipeline.
Create a file that contains the following code:
```typescript
import { PrerenderImages } from 'lup-images';

// this wrapper is needed if you are in the main file of a node project
(async () => {

// prerender images (provide same options as in the request handler)
await PrerenderImages({ ... });

})();
````
In the CI/CD pipeline or wherever you want to prerender the images, run the file using node.

0 comments on commit 560806a

Please sign in to comment.