Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/pull-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: pull-preview

on:
# zizmor: ignore[dangerous-triggers] - DO NOT add actions/checkout: the called workflow only reads PR metadata
pull_request_target:
branches:
- main
paths:
- 'docs/**'
types:
- opened
- reopened
- synchronize
- labeled
- unlabeled
- closed

permissions: {}

concurrency:
group: pull-preview-${{ github.event.pull_request.number }}
cancel-in-progress: false
queue: max

jobs:
comment:
if: github.repository == 'nuxt/image'
permissions:
pull-requests: write
uses: nuxt/nuxt.com/.github/workflows/pull-preview-comment.yml@main # zizmor: ignore[unpinned-uses] - nuxt.com owns the preview comment
7 changes: 0 additions & 7 deletions .netlify.toml

This file was deleted.

8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![nuxt-image-social-card](https://github-production-user-asset-6210df.s3.amazonaws.com/904724/261574805-5af726c5-0113-4676-9ee9-c464393caee0.png)](https://image.nuxt.com)
[![nuxt-image-social-card](https://github-production-user-asset-6210df.s3.amazonaws.com/904724/261574805-5af726c5-0113-4676-9ee9-c464393caee0.png)](https://nuxt.com/modules/image)

[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
Expand All @@ -11,7 +11,7 @@

Plug-and-play image optimization for Nuxt apps. Resize and transform your images using built-in optimizer or your favorite images CDN.

- [📖  Read Documentation](https://image.nuxt.com)
- [📖  Read Documentation](https://nuxt.com/modules/image)
- [👾  Playground](https://stackblitz.com/github/nuxt/image/tree/main/example)

## Features
Expand All @@ -29,7 +29,7 @@ Plug-and-play image optimization for Nuxt apps. Resize and transform your images
Install `@nuxt/image` dependency to your project:

```sh
npx nuxt module add image
npx nuxt add image
```

## Nuxt 2
Expand All @@ -39,7 +39,7 @@ npx nuxt module add image
### Contributing

- Clone this repository
- Enable [Corepack](https://github.com/nodejs/corepack) using `corepack enable`
- Install [pnpm](https://pnpm.io/installation)
- Install dependencies using `pnpm install`
- Run `pnpm dev:prepare` to generate type stubs.
- Use `pnpm dev` to start [playground](./playground) in development mode.
Expand Down
24 changes: 0 additions & 24 deletions docs/.gitignore

This file was deleted.

1 change: 1 addition & 0 deletions docs/.navigation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
title: Nuxt Image
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default defineNuxtConfig({

## `inject`

By default Nuxt Image v1 adopts a composable approach. If you do not use the components no additional code will be added to your bundle. But if you wish to globally initialize an `$img` helper that will be available throughout your application, you can do so.
By default Nuxt Image adopts a composable approach. If you do not use the components no additional code will be added to your bundle. But if you wish to globally initialize an `$img` helper that will be available throughout your application, you can do so.

```ts [nuxt.config.ts]
export default defineNuxtConfig({
Expand All @@ -29,7 +29,7 @@ export default defineNuxtConfig({

The quality for the generated image(s).

You can also override this option at the component level by using the [`quality` prop](/usage/nuxt-img#quality).
You can also override this option at the component level by using the [`quality` prop](/modules/image/usage/nuxt-img#quality).

```ts [nuxt.config.ts]
export default defineNuxtConfig({
Expand All @@ -45,7 +45,7 @@ Default: `['webp']`

You can use this option to configure the default format for your images used by `<NuxtPicture>`. The available formats are `webp`, `avif`, `jpeg`, `jpg`, `png`, and `gif`. The order of the formats is important, as the first format that is supported by the browser will be used. You can pass multiple values like `['avif', 'webp']`.

You can also override this option at the component level by using the [`format` prop](/usage/nuxt-picture#format).
You can also override this option at the component level by using the [`format` prop](/modules/image/usage/nuxt-picture#format).

```ts [nuxt.config.ts]
export default defineNuxtConfig({
Expand All @@ -59,7 +59,7 @@ export default defineNuxtConfig({

List of predefined screen sizes.

These sizes will be used to generate resized and optimized versions of an image (for example, with the [`sizes`](/usage/nuxt-img#sizes) modifier).
These sizes will be used to generate resized and optimized versions of an image (for example, with the [`sizes`](/modules/image/usage/nuxt-img#sizes) modifier).

```ts [nuxt.config.ts]
export default defineNuxtConfig({
Expand Down Expand Up @@ -87,7 +87,7 @@ To enable image optimization on an external website, specify which domains are a
```ts [nuxt.config.ts]
export default defineNuxtConfig({
image: {
domains: ['nuxtjs.org']
domains: ['nuxt.com']
}
})
```
Expand Down Expand Up @@ -125,7 +125,7 @@ export default defineNuxtConfig({

## `providers`

In order to create and use a [custom provider](/advanced/custom-provider), you need to use the `providers` option and define your custom providers.
In order to create and use a [custom provider](/modules/image/advanced/custom-provider), you need to use the `providers` option and define your custom providers.

::code-group
```ts [nuxt.config.ts]
Expand Down
1 change: 1 addition & 0 deletions docs/2.usage/.navigation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
title: Usage
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Will result in:
```

::note
With [default provider](/get-started/providers), you should put `/nuxt-icon.png` inside `public/` directory for Nuxt 3 make the above example work.
With [default provider](/modules/image/providers), you should put `/nuxt-icon.png` inside the `public/` directory to make the above example work.
::

## Props
Expand Down Expand Up @@ -86,7 +86,7 @@ Otherwise path that is expected by provider that starts with `/` or a URL.
<NuxtImg src="/nuxt.png" />
```

For image optimization when using external URLs in `src`, we need to whitelist them using [`domains`](/get-started/configuration#domains) option.
For image optimization when using external URLs in `src`, we need to whitelist them using [`domains`](/modules/image/configuration#domains) option.

### `width` / `height`

Expand Down Expand Up @@ -116,7 +116,7 @@ It *should always* be provided.

Specify responsive sizes.

This is a space-separated list of screen size/width pairs. You can [see a list of the defined screen sizes here](/get-started/configuration#screens).
This is a space-separated list of screen size/width pairs. You can [see a list of the defined screen sizes here](/modules/image/configuration#screens).

By default Nuxt generates *responsive-first* sizing.

Expand Down Expand Up @@ -164,7 +164,7 @@ Will result in:

Display a placeholder image before the actual image is fully loaded.

You can also use the [custom prop](/usage/nuxt-img#custom) to make any placeholder you want.
You can also use the [custom prop](/modules/image/usage/nuxt-img#custom) to make any placeholder you want.

The placeholder prop can be either a string, a boolean, a number, or an array. The usage is shown below for each case.

Expand All @@ -185,7 +185,7 @@ The placeholder prop can be either a string, a boolean, a number, or an array. T
<NuxtImg src="/nuxt.png" placeholder="./placeholder.png" />
```

You can also leverage [`useImage()`](/usage/use-image) to generate a placeholder image based on the original image, can be useful if the source is an SVG or you want better control on the modifiers:
You can also leverage [`useImage()`](/modules/image/usage/use-image) to generate a placeholder image based on the original image, can be useful if the source is an SVG or you want better control on the modifiers:

```vue
<template>
Expand Down Expand Up @@ -232,7 +232,7 @@ img:not(.my-placeholder-class) {

### `provider`

Use other provider instead of default [provider option](/get-started/configuration#provider) specified in `nuxt.config`
Use other provider instead of default [provider option](/modules/image/configuration#provider) specified in `nuxt.config`

**Example:**

Expand Down Expand Up @@ -264,7 +264,7 @@ export default defineNuxtConfig({
Presets are predefined sets of image modifiers that can be used create unified form of images in your projects.

::note
We can define presets using [presets options](/get-started/configuration#presets) in `nuxt.config`
We can define presets using [presets options](/modules/image/configuration#presets) in `nuxt.config`
::

::code-group
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Unlike the native [`<picture>` element](https://developer.mozilla.org/en-US/docs
## Props

::tip
See props supported by [`<NuxtImg>`](/usage/nuxt-img#props)
See props supported by [`<NuxtImg>`](/modules/image/usage/nuxt-img#props)
::

### `format`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ Unstable: `getSizes` API might change or be removed.
- `format`: Change the image format
- (any other custom provider modifier)
- `options`: (object)
- `provider`: (string) Provider name other than default (see [providers](/get-started/configuration#providers))
- `preset`: Use a [preset](/get-started/configuration#presets)
- `provider`: (string) Provider name other than default (see [providers](/modules/image/configuration#providers))
- `preset`: Use a [preset](/modules/image/configuration#presets)

**Example:** Responsive srcset with Vuetify `v-img`

Expand Down
1 change: 1 addition & 0 deletions docs/3.providers/.navigation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
title: Providers
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ Integration between [AWS Amplify Hosting](https://aws.amazon.com/amplify) and th

This provider will be enabled by default in AWS Amplify deployments.

::alert{type="warning"}
This is an experimental preset and will be available soon! 🚀
::

## Domains

To use external URLs (images not in `public/` directory), hostnames should be whitelisted.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ links:
Integration between [Cloudflare Images](https://developers.cloudflare.com/images/) and the image module.

::note
This provider is for **Cloudflare Images** — the image hosting and delivery product where you upload images to Cloudflare and reference them by image ID. If you want to transform images on your own domain using **Cloudflare Image Transformations** (via `/cdn-cgi/image/`), use the [`cloudflare` provider](/providers/cloudflare) instead.
This provider is for **Cloudflare Images** — the image hosting and delivery product where you upload images to Cloudflare and reference them by image ID. If you want to transform images on your own domain using **Cloudflare Image Transformations** (via `/cdn-cgi/image/`), use the [`cloudflare` provider](/modules/image/providers/cloudflare) instead.
::

## Setup
Expand Down Expand Up @@ -83,7 +83,7 @@ When you pass a `variant` modifier or no image modifiers at all, the provider us

## Modifiers

On top of the [standard modifiers](/usage/nuxt-img#modifiers), the following Cloudflare Images-specific modifiers are supported when using flexible variants:
On top of the [standard modifiers](/modules/image/usage/nuxt-img#modifiers), the following Cloudflare Images-specific modifiers are supported when using flexible variants:

| Modifier | Description |
|---|---|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,11 @@ export default defineNuxtConfig({

## Cloudimage Modifiers

Beside the [standard modifiers](/usage/nuxt-img#modifiers), also you can pass Cloudimage-specific [Cloudimage-specific transformation](https://docs.cloudimage.io/go/cloudimage-documentation-v7/en/introduction) params to `modifiers` prop.
Beside the [standard modifiers](/modules/image/usage/nuxt-img#modifiers), also you can pass Cloudimage-specific [Cloudimage-specific transformation](https://docs.cloudimage.io/transformations/image-operations) params to `modifiers` prop.

## Cloudimage `fit` Values

Beside the [standard values for `fit` property](/usage/nuxt-img#fit) of Nuxt image and Nuxt picture, Cloudimage offers the following for extra resizing params:
Beside the [standard values for `fit` property](/modules/image/usage/nuxt-img#fit) of Nuxt image and Nuxt picture, Cloudimage offers the following for extra resizing params:

- `crop` - Crops the image to specified dimensions (width and height) and keeps proportions.
- `face` - Crops the image automatically keeping the most prominent face.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Note: You will need to configure your 'Auto upload mapping' to do the above.

## Cloudinary `fit` values

Beside the [standard values for `fit` property](/usage/nuxt-img#fit) of Nuxt image and Nuxt picture, Cloudinary offers the following for extra resizing experience:
Beside the [standard values for `fit` property](/modules/image/usage/nuxt-img#fit) of Nuxt image and Nuxt picture, Cloudinary offers the following for extra resizing experience:

- `minCover` - Same like `cover` but only resizing if the original image is **smaller** than the given minimum (width and height).
- `minInside` - Same as the `inside` mode but only if the original image is **smaller** than the given minimum (width and height).
Expand All @@ -92,7 +92,7 @@ Check out [Cloudinary resize mode Documentation](https://cloudinary.com/document

## Cloudinary Modifiers

Beside the [standard modifiers](/usage/nuxt-img#modifiers), you can also pass the following Cloudinary-specific transformation params to `modifiers` prop.
Beside the [standard modifiers](/modules/image/usage/nuxt-img#modifiers), you can also pass the following Cloudinary-specific transformation params to `modifiers` prop.

::note
The Cloudinary provider automatically enables [automatic format selection](https://cloudinary.com/documentation/image_transformations#f_auto) and [automatic quality selection](https://cloudinary.com/documentation/image_optimization#automatic_quality_selection_q_auto) for best performance.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default defineNuxtConfig({
})
```

::callout{type="warning"}
::warning
**nginx users:** nginx's default `merge_slashes on` setting collapses consecutive slashes in URLs, which corrupts the embedded `https://` in Flyimg request paths (e.g. `https://flyimg.example.com/upload/-/https://www.example.com/photo.jpg`). Add `merge_slashes off;` to the `server` block of your nginx config when reverse-proxying requests to Flyimg.
::

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ export default defineNuxtConfig({

## Gumlet `mode` Values

Gumlet supports all the [standard values for `fit` property](/usage/nuxt-img#fit) of Nuxt image and Nuxt picture.
Gumlet supports all the [standard values for `fit` property](/modules/image/usage/nuxt-img#fit) of Nuxt image and Nuxt picture.

## Gumlet Modifiers

Beside the [standard modifiers](/usage/nuxt-img#modifiers), you can also pass all gumlet-specific render API parameters to the `modifiers` prop.
Beside the [standard modifiers](/modules/image/usage/nuxt-img#modifiers), you can also pass all gumlet-specific render API parameters to the `modifiers` prop.

For a full list of these modifiers and their uses, check out [Gumlet's image transform API documentation](https://docs.gumlet.com/reference/image-transform-size#mode).

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default defineNuxtConfig({

## ImageEngine `fit` Values

The [standard values for `fit` property](/usage/nuxt-img#fit) map onto [ImageEngine Directives](https://imageengine.io/docs/directives) as follows:
The [standard values for `fit` property](/modules/image/usage/nuxt-img#fit) map onto [ImageEngine Directives](https://imageengine.io/docs/directives) as follows:

- `cover`: `m_cropbox`
- `contain`: `m_letterbox`
Expand All @@ -34,7 +34,7 @@ The [standard values for `fit` property](/usage/nuxt-img#fit) map onto [ImageEng

## ImageEngine Modifiers

In addition to the [standard modifiers](/usage/nuxt-img#modifiers), you can also use all [ImageEngine Directives](https://imageengine.io/docs/directives) by adding them to the `modifiers` property with the following attribute names:
In addition to the [standard modifiers](/modules/image/usage/nuxt-img#modifiers), you can also use all [ImageEngine Directives](https://imageengine.io/docs/directives) by adding them to the `modifiers` property with the following attribute names:

- `format`: `f` directive
- `fit`: `m` directive
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default defineNuxtConfig({

## ImageKit `fit` Parameters

In addition to the standard [`fit`](/usage/nuxt-img#fit) properties of Nuxt Image and Nuxt Picture, ImageKit offers more cropping and resizing options to the users:
In addition to the standard [`fit`](/modules/image/usage/nuxt-img#fit) properties of Nuxt Image and Nuxt Picture, ImageKit offers more cropping and resizing options to the users:

- `extract` - The output image has its height, width as requested, and the aspect ratio is preserved. Unlike the `cover` parameter, we extract out a region of the requested dimension from the original image.
- `pad_extract` - This parameter is similar to `extract`. This comes in handy in scenarios where we want to extract an image of a larger dimension from a smaller image. So, the `pad_extract` mode adds solid colored padding around the image to match the exact size requested.
Expand All @@ -35,7 +35,7 @@ Read ImageKit [crop and crop mode documentation](https://docs.imagekit.io/featur

## ImageKit Modifiers

On top of the standard [Nuxt Image modifiers](/usage/nuxt-img#modifiers), a user can also leverage ImageKit-specific transformation parameters provided in the `modifier` prop.
On top of the standard [Nuxt Image modifiers](/modules/image/usage/nuxt-img#modifiers), a user can also leverage ImageKit-specific transformation parameters provided in the `modifier` prop.

### `focus`

Expand Down Expand Up @@ -134,7 +134,7 @@ Specify background color and its opacity for your image using the `bg` modifier.

## Overlay Transformation Modifiers

ImageKit's Nuxt Image integration enables you to apply overlays to [images](https://docs.imagekit.io/features/image-transformations/overlay-using-layers.md) using the `raw` parameter with the concept of [layers](https://docs.imagekit.io/features/image-transformations/overlay-using-layers.md#layers). The `raw` parameter facilitates incorporating transformations directly in the URL. A layer is a special type of transformation that allows you to apply text and image overlay along with other transformation parameters.
ImageKit's Nuxt Image integration enables you to apply overlays to [images](https://imagekit.io/docs/add-overlays-on-images) using the `raw` parameter with the concept of [layers](https://imagekit.io/docs/add-overlays-on-images). The `raw` parameter facilitates incorporating transformations directly in the URL. A layer is a special type of transformation that allows you to apply text and image overlay along with other transformation parameters.

### Overlay Image

Expand Down Expand Up @@ -176,7 +176,7 @@ const modifiers = {
</script>
```

Read more about ImageKit's overlay using layers [here](https://docs.imagekit.io/features/image-transformations/overlay-using-layers).
Read more about ImageKit's overlay using layers [here](https://imagekit.io/docs/add-overlays-on-images).

## Image Enhancement Modifiers

Expand Down
Loading
Loading