Commit graph

50 commits

Author SHA1 Message Date
Steven
7102050ec7
Add support for images.loaderFile config (#41585)
This PR adds a new configure property, `images.loaderFile` that allow
you to define a path to a file with an exported image loader function.

This is useful when migrating from `next/legacy/image` to `next/image`
because it lets you configure the loader for every instance of
`next/image` once, similar to the legacy "built-in loaders".
2022-10-21 12:31:53 -07:00
Ismael
75aab126a2
remove next/future/image ref (#41610)
## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-20 21:02:59 +00:00
Steven
17773a1cf3
Fix links to next/legacy/image demo (#41539)
This PR fixes links to `next/legacy/image` (demo, deploy, etc)
2022-10-18 16:09:43 -07:00
Steven
e2f16f96c2
Update next/image docs and examples (#41434)
This PR updates the docs for the following code change:

- #41399

There are a few updates here:

- [x] Update docs
- [x] Update links to docs inside component
- [x] Update examples
- [x] Fix corner cases in codemod
2022-10-17 10:41:35 -04:00
Steven
712d98d3d7
Update docs for remotePatterns image config (#40350)
This updates the docs to favor `remotePatterns` image config (instead of `domains`)
2022-09-08 11:19:55 -04:00
Steven
350d4cb879
Update next/future/image docs to mention the difference with next/image (#38108)
This PR update the `next/future/image` docs to mention the difference with `next/image`
2022-06-28 15:43:30 +00:00
Steven
da8d1984d2
Add experimental wildcard remotePatterns config for upstream images (#36245)
## Description 
This PR implements a new configuration object in `next.config.js` called `experimental.images.remotePatterns`.

This will eventually deprecate `images.domains` because it covers the same use cases and more by allowing wildcard pattern matching on `hostname` and `pathname` and also allows restricting `protocol` and `port`.

## Feature

- [x] Implements an existing feature request.
- [x] Related issues linked
- [x] Unit tests added
- [x] Integration tests added
- [x] Documentation added
- [x] Telemetry added. In case of a feature if it's used or not.
- [x] Errors have helpful link attached, see `contributing.md`

## Related 

- Fixes #27925 
- Closes #18429 
- Closes #18632
- Closes #18730
- Closes #27345
2022-05-05 02:19:16 +00:00
Steven
bc460229ab
Update next/image docs for width & height (#35188)
- Fixes #30219 

Co-authored-by: Rich Haines <hello@richardhaines.dev>
2022-03-17 15:16:15 -04:00
Alex Castle
76bad07bdf
Add new 'raw' image layout (#34339)
This PR adds a new layout mode for images called `raw`, as discussed with the core team a while back. This mode has the following characteristics:
 - No wrapper `span` around the `img` element
 - No sizer svg
 - Almost no styles automatically added to the `img` element
 - `style` parameter is allowed and is passed through to the underlying `img` element

This also adds documentation changes to describe the new component.

There are a few tradeoffs and DX decisions that may warrant discussion/revision before merging. I'll add a few comments to highlight those issues.

- Related to #18637
2022-03-14 10:25:23 -04:00
Aman Mittal
80a153cd41
Update multiple docs pages to follow Docs Content style guide (#33855)
This PR addresses minor docs-related styling issues on the Getting Started, Data Fetching (Get Server Side Props), etc pages. It follows the mechanics of the Docs Content Style guide to maintain consistency across all documentation. 

Also fixes some minor issues such as missing period at the end of a sentence on docs pages like as Data Fetching (getStaticProps).

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2022-02-06 04:21:35 +00:00
Onur Temiz
aaec9a9353
Update image-optimization.md (#31401)
"styled-jsx" link was broken. Added `/docs/` prefix and removed `.md` suffix to fix it.

Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
2021-11-14 23:13:16 +00:00
Steven
3bdf80dde5
Fix PerformanceObserver usage for older browsers and CI (#30387)
Browsers older than 2017 don't have PerformanceObserver https://caniuse.com/mdn-api_performanceobserver


- Fixes https://github.com/vercel/next.js/issues/30322
- Fixes https://twitter.com/fmgordillo/status/1453037730141716492
2021-10-27 00:37:19 +00:00
Kara
2fe5d011e6
Add "priority" section to Image Optimization doc (#30218)
This change addresses some feedback that some users don't realize
that the `priority` attribute exists and is critical for managing
LCP when using the next/image component. It adds a dedicated
section to the Image Optimization doc that explains how and when
to use the attribute.

Fixes #29624

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2021-10-25 21:04:00 +00:00
Steven
1a0c1e8a5b
Fix next/image when parent is <p> (#30041)
- Fixes #29717 
- Fixes #21433 
- Closes #21475
2021-10-18 21:29:19 +00:00
Steven
cc1f3b8a38
Add support for AVIF to next/image (#29683)
Add support for AVIF to `next/image`

- Fixes #27882 
- Closes #27432 

## Feature

- [x] Implements an existing feature request
- [x] Related issues linked
- [x] Integration tests added
- [x] Documentation added
- [x] Update manifest output
- [x] Warn when `sharp` is outdated
- [x] Errors & Warnings have helpful link attached
- [ ] Remove `image-size` in favor of `squoosh`/`sharp` (optional, need to benchmark)
2021-10-11 23:17:47 +00:00
Henry Blevins
8b485e161d
Fix typo in image optimization documentation (#29685)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-10-06 18:57:33 -05:00
Alex Castle
5d7b68f15e
Overhaul image component documentation (#29186)
This PR contains an overhaul of the image component documentation for next (both the [primary usage doc](https://nextjs.org/docs/basic-features/image-optimization) and the [API reference](https://nextjs.org/docs/api-reference/next/image)). This PR does not change the filepath/URL for either of those documents, but that may still be warranted as right now Google searches for "next.js image component" and the like return the API document as the first result, which is not optimal.

The changes to the docs are based on feedback from the community and with input from @leerob. I'm marking this PR a draft because we will likely want to have a round of revisions before merging, but in general I consider this PR "read to go," contingent on buy-in from other stakeholders.

The basic goal of the changes are as follows:
1. Simplify the getting started page by moving extraneous detail to the API documentation.
2. Refocus the getting started page on practical usage information
3. Add additional content to address issues that have come up as common pain-points around the image component, such as image sizing and styling.

Fixes #21786 

CC: @styfle @timneutkens @kara @spanicker
2021-10-05 21:38:48 +00:00
Steven
801e48eae9
Update docs to clarify that image imports are static (#28744)
This PR clarifies the usage for static image imports.
2021-09-02 18:51:30 +00:00
Steven
cb6290adf3
Update docs for sharp usage to mention Vercel (#28476)
There was some confusion in [this tweet](https://twitter.com/mtliendo/status/1430269174459338759) so I revised the docs around `sharp` usage.
2021-08-24 22:51:28 +00:00
Nick Crews
0608f493dd
Document that Google has begun using CLS metric (#27843)
Google has begun using Cumulative Layout Shift as a factor in ranking search results, according to the linked Google docs.

This perhaps will make this page out of sync with other Nextjs docs, but I figure better start somewhere.



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [x] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes
2021-08-08 17:52:44 +00:00
Alex Castle
1b733423d6
Use Sharp if available for Image Optimization (#27346)
* Use sharp for image transformations when available

* Refactor resizeImage and add sharp warning

* only show sharp warning once per instance

* Modify sharp error message

* Add documentation for optional sharp dependency

* Update docs/basic-features/image-optimization.md

Co-authored-by: Steven <steven@ceriously.com>

* Import types for sharp

* Update lockfile

* Add testing against sharp

* use fs-extra for node 12

* Rename test sharp path variable

* Apply suggestions from code review

Co-authored-by: Steven <steven@ceriously.com>

* update squoosh specific test

* Apply suggestions from code review

Co-authored-by: Steven <steven@ceriously.com>

* update tests

* Apply suggestions from code review

Co-authored-by: Steven <steven@ceriously.com>

Co-authored-by: Steven <steven@ceriously.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-07-22 18:11:17 -05:00
Steven
b123942694
Fix minimumCacheTTL so it doesn't affect browser caching (#27307)
In a previous PR (#27200), we added `minimumCacheTTL` to configure the time-to-live for the cached image. However, this was setting the `max-age` header.

This PR ensures that `minimumCacheTTL` doesn't affect browser caching, only the upstream header can affect browser caching.

This is a bit safer in case the developer accidentally caches something that shouldn't be and the cache needs to be invalidated. Simply delete the `.next/cache/images` directory.

- Related to #19914
- Related to #22319
2021-07-19 22:38:03 +00:00
Steven
8151a7e0dc
Add minimumCacheTTL config for Image Optimization (#27200)
- Closes #23328  
- Related to #19914 
- Related to #22319 


## Feature

- [x] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [x] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [x] Errors have helpful link attached, see `contributing.md`
2021-07-15 19:55:12 +00:00
Steven
1a8ad14089
Rename next/image dangerously-unoptimized to custom and warn when applicable (#26998)
Since we are no longer accepting new built-in loaders, users may wish to use a different cloud provider.

So this PR renames `dangerously-unoptimized` to `custom` to handle this case as well as the intention of `next export`.

If the user doesn't add a `loader` prop, we throw an error.
If the user adds a `loader` prop but it doesn't return the width, we print a warning.

- Follow up to #26847 
- Fixes #21079 
- Fixes #19612 
- Related to #26850
2021-07-08 19:35:19 +00:00
Darsh Patel
226e81c733
Add dangerously-unoptimized loader for next/image (#26847)
* add support for static loader

* update existing test

* add test

* add prettier-ignore

* update docs

* apply suggestions from review

* remove un-needed normalize

* Apply suggestions from code review

Co-authored-by: Steven <steven@ceriously.com>

* update test

Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: Steven <steven@ceriously.com>
2021-07-07 15:20:16 -05:00
Joe Bell
98acfaf8cc
Extend disclaimer for dynamic image imports (#26241)
* docs: extend disclaimer for dynamic image imports

* docs: extend guidance on blurDataURL

* Update docs/api-reference/next/image.md

Co-authored-by: Steven <steven@ceriously.com>
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2021-06-18 16:21:12 +02:00
Tim Neutkens
2967fe1df3
Update docs on static image imports (#26211)
Incorporates some of the feedback we've had about this doc.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.

## Documentation / Examples

- [ ] Make sure the linting passes
2021-06-16 18:46:01 +00:00
Steven
e4eed61a31
Update next/image docs and examples (#26150)
This updates the `next/image` docs and examples to add missing information.
2021-06-16 01:26:53 +00:00
Lee Robinson
f3cbdf0b02
Document how to use basePath with next/image. (#23123)
Supersedes https://github.com/vercel/next.js/pull/23115 for more clarity and a better recommendation.
2021-03-16 19:56:41 +00:00
Shane Rogers
308c2beca2
Add image base path configuration option (#23115)
I similarly [couldn't find this info](https://github.com/vercel/next.js/issues/19711#issuecomment-750414110) in the docs about configuring the image path when using an app `basePath`, so thought I'd add it.
2021-03-16 17:13:24 +00:00
Lee Robinson
9431439c6d
Add note about next/export to Image Optimization docs. (#23088)
https://github.com/vercel/next.js/discussions/19065#discussioncomment-484842
2021-03-16 01:05:14 +00:00
Lee Robinson
9afc0f58c4
Add docs for custom image loaders. (#20788)
Docs for https://github.com/vercel/next.js/pull/20216/.
2021-01-06 02:16:09 +00:00
matamatanot
d33d1dd00a
Ignore domains option when loader is set (#18447)
```
images: {
    domains: ['example.com'],
    path: 'https://example.com/myaccount/',
},
```
Those `domains` and `path` look a lot alike for me and so, I was confused. I found out that the domains are ignored if the Loader is set, which makes sense.
2020-12-30 01:35:37 +00:00
Wesley Tian
1231ddb001
Fix typo in image-optimization.md (#19670)
Either use `avoid` or `prevent` as verb, but not both.
2020-11-30 02:00:38 +00:00
Abdelrahman Rifai
1bb318c082
docs: fix a typo "concatenated" instead of "concatentated" (#18812) 2020-11-04 18:28:06 -05:00
Steven
35f8f521a2
Update Image docs with links to examples (#18770)
This revises the docs to add headings and also links to layout examples.

Fixes #18554
2020-11-04 17:24:14 +00:00
Steven
d4a92d92ba
Update example for Image Component (#18762) 2020-11-03 15:40:53 -05:00
Steven
2b94b1eea6
Update default widths configuration to handle 2x/3x DPI (#18717)
- Update default `deviceSizes`
- Add default `imageSizes`
- Use `layout` value to determine which `srcset` to use

Fixes #18420 
Closes #18714
2020-11-03 02:12:46 +00:00
Steven
44fe971e6b
Update image optimization docs to include blog details (#18401)
This PR documents some details that are mentioned in the blog post https://nextjs.org/blog/next-10
2020-10-28 17:29:42 +00:00
Steven
79314ef5d8
Update docs with details for cached images (#18399)
This PR explains the caching algorithm for the default loader.
2020-10-28 12:40:40 -04:00
Steven
3195de65d1
Fix docs default config values (#18319)
Missed one rename from #18294
2020-10-27 18:53:37 +00:00
Steven
ab0b0a8a4d
Update docs - add default config for images property (#18296)
- Explain how defaults work and what the default values are.
- Mention quality on the basic page
2020-10-27 14:07:33 +00:00
Steven
f773a1a44a
Rename iconSizes to imageSizes, remove size limitation (#18294)
This does two things:

- Rename `iconSizes` to `imageSizes`.
- Give priority to `imageSizes` regardless of `deviceSizes` as a means to opt-out of the srcset behavior.
2020-10-27 13:19:23 +00:00
Steven
3a169fbbf0
Separate config into deviceSizes and iconSizes (#18267)
This separates the `next.config.js` property `images.sizes` into to properties: `images.deviceSizes` and `images.iconSizes`.

The purpose is for images that are not intended to take up the majority of the viewport.


Related to #18122
2020-10-26 20:07:52 +00:00
Tim Neutkens
557a0001db
Update image-optimization.md 2020-10-26 18:17:26 +01:00
Tim Neutkens
c381a35247
Update image-optimization.md 2020-10-26 18:13:21 +01:00
Tim Neutkens
8db23295d3
Update image-optimization.md 2020-10-26 18:12:40 +01:00
Tim Neutkens
129fb85da4
Update image-optimization.md 2020-10-26 18:07:23 +01:00
Steven
ce38e4f6fe
FIx image optimization docs (#18254)
Add missing links in the documentation
2020-10-26 12:51:11 -04:00
Steven
3c6f421d99
Add docs for Image Optimization (#18107)
Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: Tim Neutkens <timneutkens@me.com>
2020-10-24 14:53:28 +02:00