-
Notifications
You must be signed in to change notification settings - Fork 273
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
Showing
10 changed files
with
119 additions
and
20 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
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,26 @@ | ||
--- | ||
menuTitle: Prismic | ||
title: Prismic Provider | ||
description: 'Nuxt Image has first class integration with Prismic' | ||
category: Providers | ||
--- | ||
|
||
Integration between [Prismic](https://prismic.io/docs) and the image module. | ||
|
||
No specific configuration is required for Prismic support. You just need to specify `provider: 'prismic'` in your configuration to make it the default, or pass it directly when you need it, for example: | ||
```html | ||
<nuxt-img provider="prismic" src="..." /> | ||
|
||
```js{}[nuxt.config.js] | ||
export default { | ||
image: { | ||
prismic: {} | ||
} | ||
} | ||
``` | ||
|
||
<alert type="info"> | ||
|
||
Prismic allows content writer to manipulate images through its UI (cropping, rezising, etc.). To preserve that behavior this provider does not strip query parameters coming from Prismic. Instead it only overrides them when needed, keeping developers in control. | ||
|
||
</alert> |
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
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 |
---|---|---|
|
@@ -10,6 +10,7 @@ const BuiltInProviders = [ | |
'imagekit', | ||
'imgix', | ||
'ipx', | ||
'prismic', | ||
'sanity', | ||
'static', | ||
'twicpics', | ||
|
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import type { ProviderGetImage } from 'src' | ||
import { joinURL, parseQuery, parseURL, stringifyQuery } from 'ufo' | ||
import { operationsGenerator } from './imgix' | ||
|
||
const PRISMIC_IMGIX_BUCKET = 'https://images.prismic.io' | ||
|
||
// Prismic image bucket is left configurable in order to test on other environments | ||
export const getImage: ProviderGetImage = ( | ||
src, | ||
{ modifiers = {}, baseURL = PRISMIC_IMGIX_BUCKET } = {} | ||
) => { | ||
const operations = operationsGenerator(modifiers) | ||
|
||
const parsedURL = parseURL(src) | ||
|
||
return { | ||
url: joinURL( | ||
baseURL, | ||
parsedURL.pathname + '?' + | ||
// Remove duplicated keys, prioritizing override from developers | ||
stringifyQuery(Object.assign(parseQuery(parsedURL.search), parseQuery(operations))) | ||
) | ||
} | ||
} |
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
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