SlideShare a Scribd company logo
Table of contents
Get started - Installation 5
Get started - Routing 9
Get started - Directory structure 11
Get started - Commands 13
Get started - Conclusion 16
Get started - Upgrading 17
Concepts - Views 18
Concepts - Context helpers 22
Concepts - Server side rendering 27
Concepts - Static site generation 29
Concepts - Nuxt lifecycle 30
Features - Rendering modes 35
Features - Transitions 36
Features - Live preview 40
Features - Deployment targets 42
Features - File system routing 44
Features - Data fetching 52
Features - Meta tags seo 58
Features - Configuration 61
Features - Loading 70
Features - Nuxt components 74
Features - Component discovery 81
Directory structure - Nuxt 84
Directory structure - Plugins 86
Directory structure - Static 93
Directory structure - Store 95
Directory structure - Nuxt config 100
Directory structure - Assets 107
Directory structure - Components 112
Directory structure - Content 115
Directory structure - Dist 122
Directory structure - Layouts 124
Directory structure - Middleware 126
Directory structure - Modules 128
nuxt
2
Views
The Views section describes all you need to know to configure data and views for a specific route in your
Nuxt Application. Views consist of an app template, a layout, and the actual page.
Composition of a View in Nuxt
Composition of a View in Nuxt
Pages
Every Page component is a Vue component but Nuxt adds special attributes and functions to make the de-
velopment of your application as easy as possible.
Properties of a page component
There are many properties of the page component such as the head property in the example above.
<template>
<h1 class="red">Hello World</h1>
</template>
<script>
export default {
head() {
// Set Meta Tags for this Page
}
// ...
}
</script>
<style>
.red {
color: red;
}
</style>
nuxt
18
Context and helpers
The context provides additional and often optional information about the current request to the application.
The context object is available in specific Nuxt functions like asyncData, plugins, middleware and nuxt-
ServerInit. It provides additional and often optional information about the current request to the
application.
First and foremost, the context is used to provide access to other parts of the Nuxt application, e.g. the
Vuex store or the underlying connect instance. Thus, we have the req and res objects in the context
available on the server side and store always available. But with time, the context was extended with
many other helpful variables and shortcuts. Now we have access to HMR (Hot Module Reload / Replace-
ment) functionalities in development mode, the current route , page params and query , as well as the
option to access environment variables through the context. Furthermore, module functions and helpers can
be exposed through the context to be available on both - the client and the server side.
All context keys that are present by default
nuxt
22
Nuxt Lifecycle
31
Rendering
Server Side Rendered Sites and Static Sites
Server-side rendered sites are rendered on the server each time the user requests a page, therefore a
server is needed to be able to serve the page on each request.
Static sites are very similar to server-side rendered applications with the main difference being that static
sites are rendered at build time, therefore no server is needed. Navigating from one page to another is then
on the client-side.
See deployment targets for more info on static and server hosting.
Info
You do not need to add ssr: true to your nuxt config in order to enable server-side-rendering as it is en-
abled by default.
Client Side Rendering Only
With client side rendering only there is no server-side rendering. Client side rendering means rendering the
content in the browser using JavaScript. Instead of getting all of the content from the HTML we just get a
basic HTML document with a JavaScript file that will then render the rest of the site using the browser. For
client side rendering set ssr to false .
Next
The ssr property
export default {
ssr: true // default value
}
export default {
ssr: false
}
Rendering
35

More Related Content

Similar to nuxt-sample.pdf

Building and Deploying Serverless Applications with NextJS and Vercel.pdf
Building and Deploying Serverless Applications with NextJS and Vercel.pdfBuilding and Deploying Serverless Applications with NextJS and Vercel.pdf
Building and Deploying Serverless Applications with NextJS and Vercel.pdf
RajasreePothula3
 
Cassandra REST API with Pagination TEAM 15
Cassandra REST API with Pagination TEAM 15Cassandra REST API with Pagination TEAM 15
Cassandra REST API with Pagination TEAM 15
Akash Kant
 
Asp.net With mvc handson
Asp.net With mvc handsonAsp.net With mvc handson
Asp.net With mvc handson
Prashant Kumar
 
Express node js
Express node jsExpress node js
Express node js
Yashprit Singh
 
Remix
RemixRemix
Rendering engine
Rendering engineRendering engine
Rendering engine
Dharita Chokshi
 
JOB PORTALProject SummaryTitle JOB-PORT.docx
JOB PORTALProject SummaryTitle    JOB-PORT.docxJOB PORTALProject SummaryTitle    JOB-PORT.docx
JOB PORTALProject SummaryTitle JOB-PORT.docx
christiandean12115
 
Sunserver Open Solaris
Sunserver Open SolarisSunserver Open Solaris
Sunserver Open Solaris
pankaj009
 
Schema-based multi-tenant architecture using Quarkus &amp; Hibernate-ORM.pdf
Schema-based multi-tenant architecture using Quarkus &amp; Hibernate-ORM.pdfSchema-based multi-tenant architecture using Quarkus &amp; Hibernate-ORM.pdf
Schema-based multi-tenant architecture using Quarkus &amp; Hibernate-ORM.pdf
seo18
 
.NET Core Apps: Design & Development
.NET Core Apps: Design & Development.NET Core Apps: Design & Development
.NET Core Apps: Design & Development
GlobalLogic Ukraine
 
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1...
 Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1... Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1...
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1...
WebStackAcademy
 
Webrender 1.0
Webrender 1.0Webrender 1.0
Webrender 1.0
Daosheng Mu
 
Kubernetes #1 intro
Kubernetes #1   introKubernetes #1   intro
Kubernetes #1 intro
Terry Cho
 
Spring MVC Framework
Spring MVC FrameworkSpring MVC Framework
Spring MVC Framework
Hùng Nguyễn Huy
 
Thesis klausi
Thesis klausiThesis klausi
Thesis klausi
mooru
 
Couchbas for dummies
Couchbas for dummiesCouchbas for dummies
Couchbas for dummies
Qureshi Tehmina
 
Web and Android App Development
Web and Android App DevelopmentWeb and Android App Development
Web and Android App Development
Gaurav Gopal Gupta
 
Making Rational HATS a Strategic Investment
Making Rational HATS a Strategic InvestmentMaking Rational HATS a Strategic Investment
Making Rational HATS a Strategic Investment
Strongback Consulting
 
128692851-Introducing-Windows-Azure.ppt
128692851-Introducing-Windows-Azure.ppt128692851-Introducing-Windows-Azure.ppt
128692851-Introducing-Windows-Azure.ppt
SaraNawghare
 
Serious Sencha - Data Layer and Server-Side REST Interface
Serious Sencha - Data Layer and Server-Side REST InterfaceSerious Sencha - Data Layer and Server-Side REST Interface
Serious Sencha - Data Layer and Server-Side REST Interface
Klaus Hofeditz
 

Similar to nuxt-sample.pdf (20)

Building and Deploying Serverless Applications with NextJS and Vercel.pdf
Building and Deploying Serverless Applications with NextJS and Vercel.pdfBuilding and Deploying Serverless Applications with NextJS and Vercel.pdf
Building and Deploying Serverless Applications with NextJS and Vercel.pdf
 
Cassandra REST API with Pagination TEAM 15
Cassandra REST API with Pagination TEAM 15Cassandra REST API with Pagination TEAM 15
Cassandra REST API with Pagination TEAM 15
 
Asp.net With mvc handson
Asp.net With mvc handsonAsp.net With mvc handson
Asp.net With mvc handson
 
Express node js
Express node jsExpress node js
Express node js
 
Remix
RemixRemix
Remix
 
Rendering engine
Rendering engineRendering engine
Rendering engine
 
JOB PORTALProject SummaryTitle JOB-PORT.docx
JOB PORTALProject SummaryTitle    JOB-PORT.docxJOB PORTALProject SummaryTitle    JOB-PORT.docx
JOB PORTALProject SummaryTitle JOB-PORT.docx
 
Sunserver Open Solaris
Sunserver Open SolarisSunserver Open Solaris
Sunserver Open Solaris
 
Schema-based multi-tenant architecture using Quarkus &amp; Hibernate-ORM.pdf
Schema-based multi-tenant architecture using Quarkus &amp; Hibernate-ORM.pdfSchema-based multi-tenant architecture using Quarkus &amp; Hibernate-ORM.pdf
Schema-based multi-tenant architecture using Quarkus &amp; Hibernate-ORM.pdf
 
.NET Core Apps: Design & Development
.NET Core Apps: Design & Development.NET Core Apps: Design & Development
.NET Core Apps: Design & Development
 
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1...
 Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1... Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1...
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1...
 
Webrender 1.0
Webrender 1.0Webrender 1.0
Webrender 1.0
 
Kubernetes #1 intro
Kubernetes #1   introKubernetes #1   intro
Kubernetes #1 intro
 
Spring MVC Framework
Spring MVC FrameworkSpring MVC Framework
Spring MVC Framework
 
Thesis klausi
Thesis klausiThesis klausi
Thesis klausi
 
Couchbas for dummies
Couchbas for dummiesCouchbas for dummies
Couchbas for dummies
 
Web and Android App Development
Web and Android App DevelopmentWeb and Android App Development
Web and Android App Development
 
Making Rational HATS a Strategic Investment
Making Rational HATS a Strategic InvestmentMaking Rational HATS a Strategic Investment
Making Rational HATS a Strategic Investment
 
128692851-Introducing-Windows-Azure.ppt
128692851-Introducing-Windows-Azure.ppt128692851-Introducing-Windows-Azure.ppt
128692851-Introducing-Windows-Azure.ppt
 
Serious Sencha - Data Layer and Server-Side REST Interface
Serious Sencha - Data Layer and Server-Side REST InterfaceSerious Sencha - Data Layer and Server-Side REST Interface
Serious Sencha - Data Layer and Server-Side REST Interface
 

More from ssuser65180a

vitepress-en.pdf
vitepress-en.pdfvitepress-en.pdf
vitepress-en.pdf
ssuser65180a
 
vitest-en.pdf
vitest-en.pdfvitest-en.pdf
vitest-en.pdf
ssuser65180a
 
vite-en.pdf
vite-en.pdfvite-en.pdf
vite-en.pdf
ssuser65180a
 
react-zh-hant.pdf
react-zh-hant.pdfreact-zh-hant.pdf
react-zh-hant.pdf
ssuser65180a
 
react-zh-hans.pdf
react-zh-hans.pdfreact-zh-hans.pdf
react-zh-hans.pdf
ssuser65180a
 
react-pl.pdf
react-pl.pdfreact-pl.pdf
react-pl.pdf
ssuser65180a
 
react-ko.pdf
react-ko.pdfreact-ko.pdf
react-ko.pdf
ssuser65180a
 
react-ja.pdf
react-ja.pdfreact-ja.pdf
react-ja.pdf
ssuser65180a
 
react-it.pdf
react-it.pdfreact-it.pdf
react-it.pdf
ssuser65180a
 
react-he.pdf
react-he.pdfreact-he.pdf
react-he.pdf
ssuser65180a
 
react-fr.pdf
react-fr.pdfreact-fr.pdf
react-fr.pdf
ssuser65180a
 
react-de.pdf
react-de.pdfreact-de.pdf
react-de.pdf
ssuser65180a
 
react-en.pdf
react-en.pdfreact-en.pdf
react-en.pdf
ssuser65180a
 
sveltekit-ja.pdf
sveltekit-ja.pdfsveltekit-ja.pdf
sveltekit-ja.pdf
ssuser65180a
 
svelte-ja.pdf
svelte-ja.pdfsvelte-ja.pdf
svelte-ja.pdf
ssuser65180a
 
svelte-en.pdf
svelte-en.pdfsvelte-en.pdf
svelte-en.pdf
ssuser65180a
 

More from ssuser65180a (16)

vitepress-en.pdf
vitepress-en.pdfvitepress-en.pdf
vitepress-en.pdf
 
vitest-en.pdf
vitest-en.pdfvitest-en.pdf
vitest-en.pdf
 
vite-en.pdf
vite-en.pdfvite-en.pdf
vite-en.pdf
 
react-zh-hant.pdf
react-zh-hant.pdfreact-zh-hant.pdf
react-zh-hant.pdf
 
react-zh-hans.pdf
react-zh-hans.pdfreact-zh-hans.pdf
react-zh-hans.pdf
 
react-pl.pdf
react-pl.pdfreact-pl.pdf
react-pl.pdf
 
react-ko.pdf
react-ko.pdfreact-ko.pdf
react-ko.pdf
 
react-ja.pdf
react-ja.pdfreact-ja.pdf
react-ja.pdf
 
react-it.pdf
react-it.pdfreact-it.pdf
react-it.pdf
 
react-he.pdf
react-he.pdfreact-he.pdf
react-he.pdf
 
react-fr.pdf
react-fr.pdfreact-fr.pdf
react-fr.pdf
 
react-de.pdf
react-de.pdfreact-de.pdf
react-de.pdf
 
react-en.pdf
react-en.pdfreact-en.pdf
react-en.pdf
 
sveltekit-ja.pdf
sveltekit-ja.pdfsveltekit-ja.pdf
sveltekit-ja.pdf
 
svelte-ja.pdf
svelte-ja.pdfsvelte-ja.pdf
svelte-ja.pdf
 
svelte-en.pdf
svelte-en.pdfsvelte-en.pdf
svelte-en.pdf
 

Recently uploaded

Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
Rohit Gautam
 
Data structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdfData structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdf
TIPNGVN2
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
Claudio Di Ciccio
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
Zilliz
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 

Recently uploaded (20)

Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
 
Data structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdfData structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdf
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 

nuxt-sample.pdf

  • 1. Table of contents Get started - Installation 5 Get started - Routing 9 Get started - Directory structure 11 Get started - Commands 13 Get started - Conclusion 16 Get started - Upgrading 17 Concepts - Views 18 Concepts - Context helpers 22 Concepts - Server side rendering 27 Concepts - Static site generation 29 Concepts - Nuxt lifecycle 30 Features - Rendering modes 35 Features - Transitions 36 Features - Live preview 40 Features - Deployment targets 42 Features - File system routing 44 Features - Data fetching 52 Features - Meta tags seo 58 Features - Configuration 61 Features - Loading 70 Features - Nuxt components 74 Features - Component discovery 81 Directory structure - Nuxt 84 Directory structure - Plugins 86 Directory structure - Static 93 Directory structure - Store 95 Directory structure - Nuxt config 100 Directory structure - Assets 107 Directory structure - Components 112 Directory structure - Content 115 Directory structure - Dist 122 Directory structure - Layouts 124 Directory structure - Middleware 126 Directory structure - Modules 128 nuxt 2
  • 2. Views The Views section describes all you need to know to configure data and views for a specific route in your Nuxt Application. Views consist of an app template, a layout, and the actual page. Composition of a View in Nuxt Composition of a View in Nuxt Pages Every Page component is a Vue component but Nuxt adds special attributes and functions to make the de- velopment of your application as easy as possible. Properties of a page component There are many properties of the page component such as the head property in the example above. <template> <h1 class="red">Hello World</h1> </template> <script> export default { head() { // Set Meta Tags for this Page } // ... } </script> <style> .red { color: red; } </style> nuxt 18
  • 3. Context and helpers The context provides additional and often optional information about the current request to the application. The context object is available in specific Nuxt functions like asyncData, plugins, middleware and nuxt- ServerInit. It provides additional and often optional information about the current request to the application. First and foremost, the context is used to provide access to other parts of the Nuxt application, e.g. the Vuex store or the underlying connect instance. Thus, we have the req and res objects in the context available on the server side and store always available. But with time, the context was extended with many other helpful variables and shortcuts. Now we have access to HMR (Hot Module Reload / Replace- ment) functionalities in development mode, the current route , page params and query , as well as the option to access environment variables through the context. Furthermore, module functions and helpers can be exposed through the context to be available on both - the client and the server side. All context keys that are present by default nuxt 22
  • 5. Rendering Server Side Rendered Sites and Static Sites Server-side rendered sites are rendered on the server each time the user requests a page, therefore a server is needed to be able to serve the page on each request. Static sites are very similar to server-side rendered applications with the main difference being that static sites are rendered at build time, therefore no server is needed. Navigating from one page to another is then on the client-side. See deployment targets for more info on static and server hosting. Info You do not need to add ssr: true to your nuxt config in order to enable server-side-rendering as it is en- abled by default. Client Side Rendering Only With client side rendering only there is no server-side rendering. Client side rendering means rendering the content in the browser using JavaScript. Instead of getting all of the content from the HTML we just get a basic HTML document with a JavaScript file that will then render the rest of the site using the browser. For client side rendering set ssr to false . Next The ssr property export default { ssr: true // default value } export default { ssr: false } Rendering 35