mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-29 17:07:22 +00:00
docs(concepts): clarify sentences (#4201)
This commit is contained in:
parent
0e4def19f8
commit
0bd801cfd8
@ -6,8 +6,8 @@ Both Browser and Server can interpret JavaScript code to render Vue.js component
|
||||
|
||||
Out of the box, a traditional Vue.js application is rendered in the browser (or **client**). Then, Vue.js generates HTML elements after the browser downloads and parses all the JavaScript code containing the instructions to create the current interface.
|
||||
|
||||
![Users have to wait for the javascript to be downloaded, parsed and executed before seeing the page's content](/img/concepts/rendering/light/csr.svg){.dark:hidden}
|
||||
![Users have to wait for the javascript to be downloaded, parsed and executed before seeing the page's content](/img/concepts/rendering/dark/csr.svg){.light:hidden}
|
||||
![Users have to wait for the browser to download, parse and execute the JavaScript before seeing the page's content](/img/concepts/rendering/light/csr.svg){.dark:hidden}
|
||||
![Users have to wait for the browser to download, parse and execute the JavaScript before seeing the page's content](/img/concepts/rendering/dark/csr.svg){.light:hidden}
|
||||
|
||||
While this technique allows building complex and dynamic UIs with smooth page transitions, it has different pros and cons:
|
||||
|
||||
@ -30,7 +30,7 @@ Client-side rendering is a good choice for heavily interactive **web application
|
||||
|
||||
When the browser requests a URL with universal (client-side + server-side) rendering enabled, the server returns a fully rendered HTML page to the browser. Whether the page has been generated in advance and cached or is rendered on the fly, at some point, Nuxt has run the JavaScript (Vue.js) code in a server environment, producing an HTML document. Users immediately get the content of our application, contrary to client-side rendering. This step is similar to traditional **server-side rendering** performed by PHP or Ruby applications.
|
||||
|
||||
To not lose the benefits of the client-side rendering method, such as dynamic interfaces and pages transitions, the Client loads the javascript code that runs on the Server in the background once the HTML document has been downloaded. It is interpreted again by the browser (hence **Universal rendering**) and Vue.js takes control of the document and enables interactivity.
|
||||
To not lose the benefits of the client-side rendering method, such as dynamic interfaces and pages transitions, the Client loads the javascript code that runs on the Server in the background once the HTML document has been downloaded. The browser interprets it again (hence **Universal rendering**) and Vue.js takes control of the document and enables interactivity.
|
||||
|
||||
Making a static page interactive in the browser is called "Hydration."
|
||||
|
||||
@ -47,7 +47,7 @@ Universal rendering allows a Nuxt application to provide quick page load times w
|
||||
### Cons
|
||||
|
||||
- **Development constraints:** Server and browser environments don't provide the same APIs, and it can be tricky to write code that can run on both sides seamlessly. Fortunately, Nuxt provides guidelines and specific variables to help you determine where a piece of code is executed.
|
||||
- **Cost:** In order to render pages on the fly, a server needs to run. This adds a monthly cost like any traditional server. However, the server calls are highly reduced thanks to universal rendering with the browser taking over on client-side navigation.
|
||||
- **Cost:** A server needs to run to render pages on the fly. This adds a monthly cost like any traditional server. However, the server calls are highly reduced thanks to universal rendering with the browser taking over on client-side navigation.
|
||||
|
||||
### Examples
|
||||
|
||||
|
@ -6,10 +6,7 @@ Contrary to a classic global declaration, Nuxt preserves typings and IDEs comple
|
||||
|
||||
::alert{type=info icon=💡}
|
||||
In the documentation, every function that is not explicitly imported is auto-imported by Nuxt and can be used as-is in your code.
|
||||
::
|
||||
|
||||
::alert{type=info icon=🚧}
|
||||
We are working on a proper API reference that will include every Nuxt auto-imports. For now, you can find a reference on the framework repository in [presets.ts](https://github.com/nuxt/framework/blob/main/packages/nuxt3/src/auto-imports/presets.ts)
|
||||
You can find a reference of auto-imported [composables](/api/composables/) and [utilities](/api/utils/) in the API section.
|
||||
::
|
||||
|
||||
::alert{type=warning}
|
||||
@ -48,7 +45,7 @@ Nuxt directly auto-imports files created in defined directories:
|
||||
|
||||
## Explicit imports
|
||||
|
||||
Every Nuxt auto-import is exposed by the `#imports` alias that can be used to make the import explicit if needed:
|
||||
Nuxt exposes every auto-import with the `#imports` alias that can be used to make the import explicit if needed:
|
||||
|
||||
```vue
|
||||
<script setup>
|
||||
|
@ -5,12 +5,12 @@ Nuxt 3 is powered by a new server engine, code-named "Nitro".
|
||||
This engine has many benefits:
|
||||
::list
|
||||
|
||||
- Cross-platform support for Node.js, Browsers, service-workers and more
|
||||
- Serverless support out-of-the-box
|
||||
- API routes support
|
||||
- Automatic code-splitting and async-loaded chunks
|
||||
- Hybrid mode for static + serverless sites
|
||||
- Development server with hot module reloading
|
||||
- Cross-platform support for Node.js, Browsers, service-workers and more.
|
||||
- Serverless support out-of-the-box.
|
||||
- API routes support.
|
||||
- Automatic code-splitting and async-loaded chunks.
|
||||
- Hybrid mode for static + serverless sites.
|
||||
- Development server with hot module reloading.
|
||||
::
|
||||
|
||||
## API Layer
|
||||
@ -54,7 +54,7 @@ The server in Nuxt 2 is not standalone, but requires part of Nuxt core to be inv
|
||||
|
||||
Nuxt 3 generates this dist when running `nuxt build` into a [`.output`](/guide/directory-structure/output) directory.
|
||||
|
||||
The output is combined with both runtime code to run your Nuxt server in any environment (including experimental browser Service Workers!) and serve you static files, making it a true hybrid framework for the JAMstack. In addition, a native storage layer is implemented, supporting multi source, drivers and local assets.
|
||||
The output is combined with both runtime code to run your Nuxt server in any environment (including experimental browser Service Workers!) and serve your static files, making it a true hybrid framework for the JAMstack. In addition, Nuxt implements a native storage layer, supporting multi source, drivers and local assets.
|
||||
|
||||
::alert{type="info" icon=IconCode}
|
||||
Checkout the Nitro engine on GitHub: [framework/packages/nitro](https://github.com/nuxt/framework/tree/main/packages/nitro)
|
||||
|
Loading…
Reference in New Issue
Block a user