-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
80b055d
commit 7b4dc98
Showing
3 changed files
with
35 additions
and
2 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 +1,28 @@ | ||
# fake-sanity-image-cdn | ||
|
||
## What is it? | ||
|
||
A proxy to use Sanity <code>@sanity/image-url</code> helper with | ||
fake image. Usefull in tests or storybook. | ||
|
||
## How to use it? | ||
|
||
Use this proxy service as the `baseUrl` when you create the | ||
imageUrlBuilder instanse: | ||
|
||
```js | ||
import imageUrlBuilder from '@sanity/image-url'; | ||
|
||
const myConfiguredSanityClient = { | ||
/_ ... _/, | ||
baseUrl: "https://fake-sanity-image-cdn.vercel.app/proxy/" | ||
}; | ||
|
||
const builder = imageUrlBuilder(myConfiguredSanityClient); | ||
|
||
console.log(builder.image("...").url())</code></pre> | ||
``` | ||
|
||
## Limitations | ||
|
||
- Do not support `webp` image transformations (`jpg` image will alwails be returned) |
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
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,3 +1,10 @@ | ||
{ | ||
"rewrites": [{ "source": "/bar(/.*)", "destination": "/api/proxy?path=$1" }] | ||
"redirects": [ | ||
{ | ||
"source": "/", | ||
"statusCode": 301, | ||
"destination": "https://github.com/gogaille/fake-sanity-image-cdn" | ||
} | ||
], | ||
"rewrites": [{ "source": "/proxy(/.*)", "destination": "/api/proxy?path=$1" }] | ||
} |