diff --git a/.github/workflows/pull-preview.yml b/.github/workflows/pull-preview.yml new file mode 100644 index 000000000..f8f2adef6 --- /dev/null +++ b/.github/workflows/pull-preview.yml @@ -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 diff --git a/.netlify.toml b/.netlify.toml deleted file mode 100644 index 9af6fe758..000000000 --- a/.netlify.toml +++ /dev/null @@ -1,7 +0,0 @@ -# https://docs.netlify.com/build/configure-builds/file-based-configuration/ - -[build] - base = "docs" - command = "pnpm build" - publish = "dist" - ignore = "git diff --quiet HEAD^ HEAD . ../package.json" diff --git a/README.md b/README.md index 11dd9a163..a2a3078c0 100755 --- a/README.md +++ b/README.md @@ -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] @@ -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 @@ -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 @@ -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. diff --git a/docs/.gitignore b/docs/.gitignore deleted file mode 100644 index 4a7f73a2e..000000000 --- a/docs/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -# Nuxt dev/build outputs -.output -.data -.nuxt -.nitro -.cache -dist - -# Node dependencies -node_modules - -# Logs -logs -*.log - -# Misc -.DS_Store -.fleet -.idea - -# Local env files -.env -.env.* -!.env.example diff --git a/docs/.navigation.yml b/docs/.navigation.yml new file mode 100644 index 000000000..8d4dcfa4b --- /dev/null +++ b/docs/.navigation.yml @@ -0,0 +1 @@ +title: Nuxt Image diff --git a/docs/content/1.get-started/2.configuration.md b/docs/1.configuration.md similarity index 89% rename from docs/content/1.get-started/2.configuration.md rename to docs/1.configuration.md index 340167bd2..eb82da287 100644 --- a/docs/content/1.get-started/2.configuration.md +++ b/docs/1.configuration.md @@ -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({ @@ -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({ @@ -45,7 +45,7 @@ Default: `['webp']` You can use this option to configure the default format for your images used by ``. 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({ @@ -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({ @@ -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'] } }) ``` @@ -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] diff --git a/docs/2.usage/.navigation.yml b/docs/2.usage/.navigation.yml new file mode 100644 index 000000000..65d1e0c8d --- /dev/null +++ b/docs/2.usage/.navigation.yml @@ -0,0 +1 @@ +title: Usage diff --git a/docs/content/2.usage/1.nuxt-img.md b/docs/2.usage/1.nuxt-img.md similarity index 92% rename from docs/content/2.usage/1.nuxt-img.md rename to docs/2.usage/1.nuxt-img.md index d1df456ed..720074e23 100644 --- a/docs/content/2.usage/1.nuxt-img.md +++ b/docs/2.usage/1.nuxt-img.md @@ -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 @@ -86,7 +86,7 @@ Otherwise path that is expected by provider that starts with `/` or a URL. ``` -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` @@ -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. @@ -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. @@ -185,7 +185,7 @@ The placeholder prop can be either a string, a boolean, a number, or an array. T ``` -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