Commit graph

246 commits

Author SHA1 Message Date
Steven
83cd45215a
Add warning when image has unused sizes prop (#31064)
- Related to https://twitter.com/jaffathecake/status/1456579637987979265
- Closes #30640
2021-11-08 16:34:30 +00:00
Nicolas
19a6158631
Add config support for build activity indicator position (#30109)
When you edit your code, and Next.js is compiling the application, a compilation indicator appears in the bottom right corner of the page.

In some cases this indicator can be misplaced on the page, for example, when conflicting with a chat launcher. To change its position, open `next.config.js` and set the `buildActivityPosition` in the `devIndicators` object to `bottom-right` (default), `bottom-left`, `top-right` or `top-left`.

I also added the documentation for both `devIndicators.buildActivity` & the new `devIndicators.buildActivityPosition`.

## Feature

- [x] Implements a new feature
- [x] Documentation added
2021-11-03 21:17:36 +00:00
JJ Kasper
7cd9ffc519
Add note about rewrites query updating (#30747)
This adds a note for the query being updated for rewrites on static pages. 

Closes: https://github.com/vercel/next.js/issues/30720

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2021-11-02 10:17:09 +00:00
Erik Hedberg
cd36e8c9d4
Fix spelling error (#30737) 2021-11-01 16:30:40 +01:00
Lee Robinson
175dd0f286
Add security notes to the URL imports documentation. (#30708) 2021-11-01 07:35:25 +01:00
Lucas Vazquez
790261682b
Update examples at headers documentation (#30502)
Several examples at https://nextjs.org/docs/api-reference/next.config.js/headers have a comma at the end of the returns, which makes them invalid examples.
2021-10-28 03:20:05 +00:00
Balázs Orbán
574651adfd
docs: update Middleware API reference (#30485)
I changed the order of `NextRequest` and `NextFetchEvent` as they are presented in the function signature.

There also seemed to be some issues with the heading levels.

Also, `NextResponse` is a documented API, but the example code uses `Response`. I wasn't sure if this was a mistake in the docs or in the code.

I noticed that other similar docs pages have a collapsible `Examples` section at their top:

- https://nextjs.org/docs/api-reference/next/image
- https://nextjs.org/docs/api-reference/next/head
- https://nextjs.org/docs/api-reference/next/amp

Image below:
![image](https://user-images.githubusercontent.com/18369201/139145600-9f45d5be-b11c-4780-be95-c7f2ebeb49a9.png)

Should the Middleware docs have the same?
2021-10-27 21:08:54 +00:00
Bruce Rodrigues
8316b8df43
Removing duplicated instead word (#30442)
Just removing the duplicated use of `instead` on `next.config.js/rewrites`  doc
2021-10-27 15:29:54 +00:00
Rich Haines
a4a77595de
Added warning about trusted domains (#30348) 2021-10-26 20:55:21 +02:00
Lee Robinson
3466b740ae
Add more docs (#30320)
Co-authored-by: Steven <steven@ceriously.com>
2021-10-26 11:07:32 -04:00
Steven
4782cacecf
Add warning when LCP image is missing priority prop (#30221) 2021-10-25 17:59:00 -04:00
Tobias Koppers
04e1e01f18
test, fix and document all possible import types for URL imports (#30165)
resolve absolute URLs in CSS when using urlImports
remove `[path]` from static static image output path
replace file-loader with asset module, remove file-loader
2021-10-25 01:54:16 +02:00
Steven
ca65fd8f87
Change AVIF to opt-in via configuration (#30180)
AVIF (shown in purple) is generally slower to encode than WebP (shown in yellow) so it is probably not a good default for on-demand Image Optimization.

Instead, we'll let users opt-in via `formats` configuration.

![performance](https://user-images.githubusercontent.com/229881/138511198-b987d307-17c2-47c2-816f-766a43d77efd.png)
2021-10-22 21:08:03 +00:00
Steven
6f3e9470a6
Ensure error message prints next.config.mjs (#30152)
This PR ensures we print the correct error message for either `next.config.js` or `next.config.mjs`, whichever was detected.
2021-10-21 23:04:40 +00:00
Tobias Koppers
d07107f2c6
add experimental.urlImports option (#30079)
Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: Rich Haines <hello@richardhaines.dev>
2021-10-21 13:14:57 +02:00
Steven
dda14e7f4b
Add image example with background color using blurDataURL (#30111)
Demo: https://nextjs-examples-image-component-igy6n5cs1.vercel.sh/
2021-10-20 19:05:54 +00:00
Steven
f2cf092ee6
Print error when images.loader is assigned but images.path is not (#30080)
Fixes #29744
2021-10-20 00:17:24 +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
fcc8380642
Update docs for image caching behavior (#29895)
Revises docs to explain that the maximum of the header and config is used.
2021-10-14 00:01:17 +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
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
Tim Neutkens
9581658b8a
Use npx create-next-app@latest instead of the version that is installed (#29595) 2021-10-04 11:13:45 +02:00
JJ Kasper
a9ad8cbbd9
Update permanent redirect field documentation (#29557)
This explains what the permanent field does a bit more for redirects. 

## Documentation / Examples

- [x] Make sure the linting passes

x-ref: https://github.com/vercel/next.js/discussions/29556
2021-10-04 08:28:35 +00:00
JJ Kasper
f8e283c7ba
Ensure href/as behavior points to correct docs (#29270)
Adds an additional note about `href`/`as` behavior so that users understand which docs should be looked at for how they are using it. 


## Documentation / Examples

- [x] Make sure the linting passes


x-ref: https://github.com/vercel/next.js/issues/26169#issuecomment-924206396
2021-09-22 19:07:07 +00:00
x4th
37c66dcd84
Update router.prefetch section to clarify it supports dynamic routes (#29070)
* Update router.prefetch section to clarify it supports dynamic routes

* Apply suggestions from code review

Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-09-17 11:18:02 -05:00
Nwachukwu Daniel (DONSN)
248c6fc88d
Fixed issue with grammar (#28964)
Changed - function component to - functional component in the heading and sentence below:

If the child of `Link` is a functional component, in addition to using `passHref`, you must wrap the component



## 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

- [ ] Make sure the linting passes
2021-09-09 14:24:01 +00:00
scottrepreneur
ee71f9d863
name should be key (#28917)
Small fix on parameter expecting to be de-duped
2021-09-08 14:00:34 +00:00
Lee Robinson
1fcd8c2e4d
Update next/link API docs to mention a11y and ESLint rule. (#28841)
Based on feedback from Twitter. 

https://twitter.com/marcysutton/status/1431432062506917890
2021-09-07 15:10:27 +00:00
Alex Vilchis
2425f4703c
(docs) Add permanent property in redirect object (#28852)
I found that an example for a redirect rule in the documentation doesn't have the required property `permanent`. I noticed this because I tried to use that same rule but building fails with the following message:

```
`permanent` is not set to `true` or `false` for route {"source":"/:path((?!another-page$).*)","has":[{"type":"host","value":"example.com"}],"destination":"/another-page"}


Error: Invalid redirect found
```

My PR simply adds the missing `permanent` property as false to be consistent with the rest.

## Documentation / Examples

- [x] Make sure the linting passes
2021-09-06 23:20:15 +00:00
Alex Vilchis
947db315cf
(docs) Remove duplicate comma (#28850)
- [X] Make sure the linting passes
2021-09-06 18:31:31 +00:00
Alex Castle
c9efbe1818
Update image styling doc (#28724)
In talking to partners, I've seen a lot of confusion about the number of wrapping `<div>`s around the image element rendered by `next/image`. There's always just one single wrapper--this PR updates the docs to make that a little more explicit.
2021-09-02 05:48:55 +00:00
Mike Hedman
d209435724
Small grammar fixes (#28590)
"exclusive of" implies that it doesn't pertain to `export` https://www.merriam-webster.com/dictionary/exclusive%20of  "Exclusive to" implies that it's only relevant to `export`.  
Also changed "can not" to "cannot".



## 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

- [ ] Make sure the linting passes
2021-08-28 21:56:32 +00:00
Scotty Waggoner
04cc37f763
Add docs for using pageExtensions to colocate other files with page components (#22740)
Feel free to edit this/suggest changes as you see fit to match the style of your docs or how you want this feature represented.

There seemed to be many issues regarding colocating non-page files with page components in  the `pages` directory where `pageExtensions` was finally suggested as a solution. I think it would be great to document it better since it seems to be a often requested workflow to colocate test, generated files, styles, and other files needed by page components in the `pages` directory. The note that exists in the docs currently alludes to the ability to do this but it doesn't contain much context that would help make it more discoverable.

Relevant issues:
https://github.com/vercel/next.js/discussions/11113#discussioncomment-427139
https://github.com/vercel/next.js/issues/8454#issuecomment-560432659
https://github.com/vercel/next.js/issues/8617#issuecomment-790030032
https://github.com/vercel/next.js/issues/3728#issuecomment-523789071
2021-08-27 22:58:56 +00:00
Lee Robinson
8afa24fca5
Improved next/image docs around layouts. (#28345)
There's been community feedback the `layouts` section of `next/image` docs could be improved. Thanks to this great article (https://blog.eyas.sh/2021/08/gatsby-to-next-js/), I've added a helpful table here giving a high-level overview, as well as re-organized the `layout` section to be more helpful.
2021-08-23 17:39:19 +00:00
Lee Robinson
d5dc968134
Improve React Strict Mode documentation. (#28139)
The current text linked wasn't obvious. Plus, the best description of what Strict Mode is was at the bottom of the document.
2021-08-15 17:44:00 +00:00
Sam Poder
d57d9a5173
Add a Styling Section to next/image component docs (#28055)
## Feature

- [x] Documentation added

## Documentation / Examples

- [x] Make sure the linting passes

It seems that people currently struggle to style their image: https://twitter.com/achrlswrth/status/1425695122029744128, this clarifies that you can use className to do this (something I just learnt!). At the moment, this is kind of hidden in "other props" I think this makes it more clear for people

Thanks,

Sam
2021-08-14 03:56:33 +00:00
Houssein Djirdeh
df83ccb7cd
[ESLint] Documentation updates + bug fixes (#26331)
Documentation:

- Expands the "Migrating Existing Config" section of ESLint doc to explain in more detail
- Minor changes to the "Ignoring ESLint" doc

Bug fixes:

- Adds `browser` and `node` environments to `eslint-config-next`. Closes #26319
- Fixes `no-document-import` rule. Closes #26159
- Fixes `no-page-custom-font` rule. Closes #26160 #26894
2021-08-05 00:58:06 +00:00
Christian
d368f76b4d
Add a note about the existence of 'next/script' (#27725)
For users looking at the api reference for 'next/head' it might be a good idea to let them know that there is the 'next/script' component. Using 'next/script' has a lot of advantages over adding a script tag with 'next/head'

## Documentation / Examples

- [x] Make sure the linting passes
2021-08-03 21:07:58 +00:00
Steven
46e7658f7e
Add next.config.js option to override default keepAlive (#27709)
Follow up to #27376 so users can disable keep-alive.

See comment https://github.com/vercel/next.js/pull/27376#issuecomment-885415623
2021-08-03 00:38:42 +00:00
Steven
b05cdb1f64
Add naturalWidth/naturalHeight to onLoadingComplete() callback (#27695)
Resolves #27213
2021-08-02 23:14:38 +00:00
JJ Kasper
c0bb1bc82c
Fix incorrect example in headers and rewrites docs (#27652)
x-ref: https://github.com/vercel/next.js/issues/22660#issuecomment-890400273

## Documentation / Examples

- [x] Make sure the linting passes
2021-07-31 21:53:47 +00:00
JJ Kasper
1af78928d6
Document redirect query passing behavior (#27545)
This documents the request query passing behavior of redirects to help avoid confusion. 

## Documentation / Examples

- [x] Make sure the linting passes

Closes: https://github.com/vercel/next.js/issues/27194
2021-07-27 21:34:19 +00:00
Aryan Beezadhur
f3fcbef2cb
Update custom-page-extensions.md (#27541) 2021-07-27 20:15:50 +00:00
Steven
bf02cf84d9
Update next/image docs with onLoadingComplete() (#27440)
Follow up to #26824
2021-07-23 15:40:33 +00:00
Yubin
4e74db2d55
Add lazyBoundary prop to Image component (#27258)
This PR adds `lazyBoundary` prop on Image Component.
This feature is to load the images earlier.
I'm not good at English. So, I couldn't explain enough in the documentation what `lazyBoundary` is.

Feature request: https://github.com/vercel/next.js/discussions/24552

## Feature

- [x] 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`
- [x] Integration tests added
- [x] 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
2021-07-23 14:44:38 +00:00
Isaac Abotsi
09baca03ad
docs: add note for Image responsive layout (#25915)
With the default Next.js template project, the .main and .container divs have `display: flex` style rule. However, as commented in [this issue](https://github.com/vercel/next.js/issues/18489#issuecomment-857146988), if may not display properly an <Image /> placed as direct child.



## Documentation / Examples

- [x] Make sure the linting passes
2021-07-20 20:05:56 +00:00
Sam Taal
a96739fc49
Add extra explanation to next/image about positioning (#27341)
* Add extra explanation to next/image about positioning

In my experience, when using next/image, a lot of devs forget about the `position: relative` when using `layout: fill`. I think it's a small and effective change to implement this one line to make it more clear.

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

* lint-fix

Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-07-20 10:30:08 -05:00
JJ Kasper
c7deb760b6
Document full routes order in rewrites doc (#27247)
This expands on https://github.com/vercel/next.js/pull/27211 and lists the full routes order used in Next.js to allow more exact matching when leveraging the different rewrite priorities. 

## Documentation / Examples

- [x] Make sure the linting passes
2021-07-16 18:03:50 +00:00
JJ Kasper
6e99f7af39
Add note about beforeFiles continuing (#27211)
This adds a note explaining that `beforeFiles` continue instead of checking the filesystem/dynamic routes immediately like they do in `afterFiles` and `fallback`. 

## Documentation / Examples

- [x] Make sure the linting passes

Closes: https://github.com/vercel/next.js/issues/26795
2021-07-16 16:13:40 +00:00
Steven
3b9786925d
Add jsdoc types to docs snippets (#27125)
This PR adds the JSDoc types so that VS Code and other tools can use autocompletion when editing `next.config.js`
2021-07-12 20:57:38 +00:00