SlideShare a Scribd company logo
Nuxt.js for Drupal developers
by Wolfgang Ziegler // fago
About me
Wolfgang Ziegler // fago
CEO / CTO of drunomics GmbH
Contributions
○ Drupal 8 Entity API & Typed Data API
○ D7 Contrib: Rules, Entity API, Field
Collection, Profile2
Twitter: @the_real_fago
drupal.org/u/fago
like Vue.js: Easy to get started, performant, enjoyable!
The Intuitive Vue Framework
What does it provide?
● fully-fledged vue.js app setup
■ Transpilation, CSS (Pre-)Processors
■ Routing (vue-router), automatic code splitting
■ Vuex store setup
■ Server-rendering (SSR), SEO Friendly (vue-meta)
● Deployment target: Server Side Rendered or Static
● Modules Ecosystem
Getting started
npx create-nuxt-app <name>
Project creation options
● Javascript / Typescript, Yarn / Npm
● UI framework (Tailwind CSS, Bootstrap, Buefy/Bulma,...)
● Linting tools (Eslint, Prettier, Stylelint, Commitlint)
● Testing frameworks (Jest, AVA, Webdriver IO, Nightwatch)
● Rendering mode - Universal (SSR/SSG) / SPA
● Deployment target (Server / Static)
npm run dev
Drupalcon 2021 - Nuxt.js for drupal developers
Working with Nuxt
Project structure
├── components
├── node_modules
├── pages
├── static
├── store
├── nuxt.config.js
├── package.json
├── package-lock.json
└── README.md
Pages
● special Vue components, integrate with Vue
routing
● Component is acting as “Controller”
● Auto-generates route based upon file-name
● Dynamic parameters via _param convention
Drupalcon 2021 - Nuxt.js for drupal developers
Nuxt lifecycle methods
Components
● fetch()
More: https://nuxtjs.org/docs/concepts/nuxt-lifecycle/
Pages (selection)
● asyncData
● head
● layout
● transition (property)
Nuxt Context
● Provides access to all the APIs/objects of the application
const context =
{app, store, route, params, query, env, isDev,
isHMR, redirect, error, $config }
● Passed as argument OR
accessible via this.$nuxt.context
Process flags & Context
if (process.server) {
const { req, res, beforeNuxtRender } = context
}
if (process.client) {
const { from, nuxtState } = context
}
if (process.static) {
// Static deployment target is in use.
}
Context & helpers overview
● Great cheat-sheet at
https://nuxtjs.org/docs/concepts/context-helpers/
Drupalcon 2021 - Nuxt.js for drupal developers
Nuxt Components Discovery
● Auto-import used components
● Lazy loading (Async components)
● Production code-splitting
Enable via nuxt.config.js:
export default {
components: true
}
Drupalcon 2021 - Nuxt.js for drupal developers
Connecting to Drupal
Do It Yourself
● Implement asyncData / fetch hooks
● Use Drupal APIs like REST, JSON API, GraphQL
with Nuxt modules like
@nuxtjs/axios, @nuxt/http
@nuxtjs/apollo (GraphQL)
● Use general SDKs like
npmjs.com/package/drupal-js-sdk
npmjs.com/package/drupal-jsonapi-params
npmjs.com/package/@gdwc/drupal-state
https://druxtjs.org
DruxtJS 101: Fully Decoupled Drupal with JSON:API and Nuxt.js
Lupus Nuxt.js Drupal Stack
Lupus Nuxt.js Drupal Architecture
GET /home GET drupal.site/home
Custom Elements
HTML
Server-Side-
Rendering
Lupus Nuxt.js Drupal Stack
Resources
● https://stack.lupus.digital
● Modules
○ Drupal module - Lupus Custom Elements Renderer
○ Nuxt module - Nuxt.js Drupal Custom Elements Connector
● Getting Started With the Lupus Nuxt.js Drupal Stack /
DrupalCon North America 2021
Extending Nuxt
Nuxt Modules are Nuxt extensions
They
● extend Nuxt core functionality
● add endless integrations
Adding a module
● Install package, e.g.
npm install nuxtjs-drupal-ce
● Configure the module in nuxt.config.js under
modules or buildModules
{
buildModules: [
'nuxtjs-drupal-ce'
],
'nuxtjs-drupal-ce': {
baseURL: 'https://your-drupal.site'
}
}
Modules & The Ecosystem
● https://nuxtjs.org/modules/
● Typescript, Proxy, i18n, PWA, Sitemaps, ...
● UI frameworks (Tailwind CSS, Bootstrap, Buefy/Bulma,...)
● Linting tools (Eslint, Prettier, Stylelint, Commitlint)
● Testing frameworks (Jest, AVA, Webdriver IO, Nightwatch)
● Analytics (GTag, Adsense, Plausible, Matomo, … )
….
Go-to solutions for common problems!
Modules
can provide one or many plugins
extend and alter Nuxt via hooks
Plugins
run code on run-time, each request
(before instantiating the root Vue.js Application)
Middleware
before rendering page/pages - universal
serverMiddleware
runs only on the server - before processing requests
Plugins
● Live in the plugins directory and re configured in
nuxt.config.js
● Can be limited to client or server side by file-name or config
● Typical use-cases are:
○ Inject $helpers into $context - e.g. $drupalCe
○ Add Vue plugins to the application
e.g. Vue.use(VToolTip)
○ Customize external packages. e.g. add Axios interceptors
Outlook
Nuxt2 -> Vue2
● Nuxt 2 (stable) uses Vue 2
● Vue3 is stable
○ but not yet default
○ provides vue2 compatibility and upgrade tools
● Nuxt3 is coming and switches to Vue3
○ will take time to become stable
● Nuxt2 is good for starting new projects!
Nuxt3 features
● Composition API
● Webpack5 and/or Vite support
● Nuxt Nitro
● Nuxt Bridge
Drupalcon 2021 - Nuxt.js for drupal developers
Resources
● https://nuxtjs.org/
○ Getting started
○ https://nuxtjs.org/modules
○ Nuxt 3
● Discord Nuxt.js
● https://druxtjs.org
● https://stack.lupus.digital
What did you think?
Have a look at the session description below
and take the survey for each session:
https://events.drupal.org/europe2021/schedule/all

More Related Content

PPTX
Link Virtualization based on Xen
PDF
Slides for Ph.D. Thesis Defense of Dheryta Jaisinghani at IIIT-Delhi, INDIA
PPTX
Ensemble learning
PPTX
PPTX
Machine learning introduction
PPTX
Ensemble methods in machine learning
PPTX
Introduction to Parallel and Distributed Computing
PPT
Distributed & parallel system
Link Virtualization based on Xen
Slides for Ph.D. Thesis Defense of Dheryta Jaisinghani at IIIT-Delhi, INDIA
Ensemble learning
Machine learning introduction
Ensemble methods in machine learning
Introduction to Parallel and Distributed Computing
Distributed & parallel system

What's hot (20)

PPT
Recommendation system
PDF
Recommendation System Explained
PPT
5 Names, bindings,Typechecking and Scopes
PPT
Operating Systems - "Chapter 4: Multithreaded Programming"
PPT
Network topology
PPTX
Ensemble learning Techniques
PPT
Spatial data mining
ODP
Machine Learning with Decision trees
PDF
Tutorial on Bias in Rec Sys @ UMAP2020
PPT
Windows internals
PPTX
Hyperparameter Tuning
PPTX
Load Balancing in Parallel and Distributed Database
PPT
Data preprocessing
PPTX
Paging and segmentation
PDF
Creating data apps using Streamlit in Python
PPTX
Page replacement
PDF
The CAP Theorem
PPTX
Intro to machine learning
PPTX
Unsupervised learning (clustering)
PPTX
Memory virtualization
Recommendation system
Recommendation System Explained
5 Names, bindings,Typechecking and Scopes
Operating Systems - "Chapter 4: Multithreaded Programming"
Network topology
Ensemble learning Techniques
Spatial data mining
Machine Learning with Decision trees
Tutorial on Bias in Rec Sys @ UMAP2020
Windows internals
Hyperparameter Tuning
Load Balancing in Parallel and Distributed Database
Data preprocessing
Paging and segmentation
Creating data apps using Streamlit in Python
Page replacement
The CAP Theorem
Intro to machine learning
Unsupervised learning (clustering)
Memory virtualization
Ad

Similar to Drupalcon 2021 - Nuxt.js for drupal developers (20)

PPTX
Server Side Rendering with Nuxt.js
PDF
Supercharge your next Vue app with Nuxt
PDF
What is Nuxt js A Beginner’s Guide to Modern Vue Development
PDF
Getting started with the Lupus Nuxt.js Drupal Stack
PDF
Pre rendering media sites with nuxt.js & netlify
PDF
nuxt-en.pdf
PDF
Between a SPA and a JAMstack: Building Web Sites with Nuxt/Vue, Strapi and wh...
PDF
Drupal point of vue
PDF
nuxt-sample.pdf
PDF
Nuxt.JS Introdruction
PDF
Nuxtjs cheat-sheet
PDF
An introduction to nuxt.js
PDF
Production Ready Vue Apps With Nuxt.js
PDF
Bringing Interactivity to Your Drupal Site with Node.js Integration
PDF
Hello world - intro to node js
PPTX
Getting Started with Vuejs
PPTX
Introduction to Node js
PDF
Decoupling Drupal mit dem Lupus Nuxt.js Drupal Stack
PDF
Next.js with drupal, the good parts
PPTX
After the LAMP, it's time to get MEAN
Server Side Rendering with Nuxt.js
Supercharge your next Vue app with Nuxt
What is Nuxt js A Beginner’s Guide to Modern Vue Development
Getting started with the Lupus Nuxt.js Drupal Stack
Pre rendering media sites with nuxt.js & netlify
nuxt-en.pdf
Between a SPA and a JAMstack: Building Web Sites with Nuxt/Vue, Strapi and wh...
Drupal point of vue
nuxt-sample.pdf
Nuxt.JS Introdruction
Nuxtjs cheat-sheet
An introduction to nuxt.js
Production Ready Vue Apps With Nuxt.js
Bringing Interactivity to Your Drupal Site with Node.js Integration
Hello world - intro to node js
Getting Started with Vuejs
Introduction to Node js
Decoupling Drupal mit dem Lupus Nuxt.js Drupal Stack
Next.js with drupal, the good parts
After the LAMP, it's time to get MEAN
Ad

Recently uploaded (20)

PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Machine learning based COVID-19 study performance prediction
PDF
cuic standard and advanced reporting.pdf
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
Cloud computing and distributed systems.
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PPT
Teaching material agriculture food technology
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Empathic Computing: Creating Shared Understanding
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Review of recent advances in non-invasive hemoglobin estimation
Machine learning based COVID-19 study performance prediction
cuic standard and advanced reporting.pdf
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Cloud computing and distributed systems.
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Teaching material agriculture food technology
NewMind AI Weekly Chronicles - August'25 Week I
Diabetes mellitus diagnosis method based random forest with bat algorithm
Empathic Computing: Creating Shared Understanding
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Network Security Unit 5.pdf for BCA BBA.
20250228 LYD VKU AI Blended-Learning.pptx

Drupalcon 2021 - Nuxt.js for drupal developers

  • 1. Nuxt.js for Drupal developers by Wolfgang Ziegler // fago
  • 2. About me Wolfgang Ziegler // fago CEO / CTO of drunomics GmbH Contributions ○ Drupal 8 Entity API & Typed Data API ○ D7 Contrib: Rules, Entity API, Field Collection, Profile2 Twitter: @the_real_fago drupal.org/u/fago
  • 3. like Vue.js: Easy to get started, performant, enjoyable! The Intuitive Vue Framework
  • 4. What does it provide? ● fully-fledged vue.js app setup ■ Transpilation, CSS (Pre-)Processors ■ Routing (vue-router), automatic code splitting ■ Vuex store setup ■ Server-rendering (SSR), SEO Friendly (vue-meta) ● Deployment target: Server Side Rendered or Static ● Modules Ecosystem
  • 7. Project creation options ● Javascript / Typescript, Yarn / Npm ● UI framework (Tailwind CSS, Bootstrap, Buefy/Bulma,...) ● Linting tools (Eslint, Prettier, Stylelint, Commitlint) ● Testing frameworks (Jest, AVA, Webdriver IO, Nightwatch) ● Rendering mode - Universal (SSR/SSG) / SPA ● Deployment target (Server / Static)
  • 11. Project structure ├── components ├── node_modules ├── pages ├── static ├── store ├── nuxt.config.js ├── package.json ├── package-lock.json └── README.md
  • 12. Pages ● special Vue components, integrate with Vue routing ● Component is acting as “Controller” ● Auto-generates route based upon file-name ● Dynamic parameters via _param convention
  • 14. Nuxt lifecycle methods Components ● fetch() More: https://nuxtjs.org/docs/concepts/nuxt-lifecycle/ Pages (selection) ● asyncData ● head ● layout ● transition (property)
  • 15. Nuxt Context ● Provides access to all the APIs/objects of the application const context = {app, store, route, params, query, env, isDev, isHMR, redirect, error, $config } ● Passed as argument OR accessible via this.$nuxt.context
  • 16. Process flags & Context if (process.server) { const { req, res, beforeNuxtRender } = context } if (process.client) { const { from, nuxtState } = context } if (process.static) { // Static deployment target is in use. }
  • 17. Context & helpers overview ● Great cheat-sheet at https://nuxtjs.org/docs/concepts/context-helpers/
  • 19. Nuxt Components Discovery ● Auto-import used components ● Lazy loading (Async components) ● Production code-splitting Enable via nuxt.config.js: export default { components: true }
  • 22. Do It Yourself ● Implement asyncData / fetch hooks ● Use Drupal APIs like REST, JSON API, GraphQL with Nuxt modules like @nuxtjs/axios, @nuxt/http @nuxtjs/apollo (GraphQL) ● Use general SDKs like npmjs.com/package/drupal-js-sdk npmjs.com/package/drupal-jsonapi-params npmjs.com/package/@gdwc/drupal-state
  • 23. https://druxtjs.org DruxtJS 101: Fully Decoupled Drupal with JSON:API and Nuxt.js
  • 25. Lupus Nuxt.js Drupal Architecture GET /home GET drupal.site/home Custom Elements HTML Server-Side- Rendering
  • 26. Lupus Nuxt.js Drupal Stack Resources ● https://stack.lupus.digital ● Modules ○ Drupal module - Lupus Custom Elements Renderer ○ Nuxt module - Nuxt.js Drupal Custom Elements Connector ● Getting Started With the Lupus Nuxt.js Drupal Stack / DrupalCon North America 2021
  • 28. Nuxt Modules are Nuxt extensions They ● extend Nuxt core functionality ● add endless integrations
  • 29. Adding a module ● Install package, e.g. npm install nuxtjs-drupal-ce ● Configure the module in nuxt.config.js under modules or buildModules { buildModules: [ 'nuxtjs-drupal-ce' ], 'nuxtjs-drupal-ce': { baseURL: 'https://your-drupal.site' } }
  • 30. Modules & The Ecosystem ● https://nuxtjs.org/modules/ ● Typescript, Proxy, i18n, PWA, Sitemaps, ... ● UI frameworks (Tailwind CSS, Bootstrap, Buefy/Bulma,...) ● Linting tools (Eslint, Prettier, Stylelint, Commitlint) ● Testing frameworks (Jest, AVA, Webdriver IO, Nightwatch) ● Analytics (GTag, Adsense, Plausible, Matomo, … ) …. Go-to solutions for common problems!
  • 31. Modules can provide one or many plugins extend and alter Nuxt via hooks Plugins run code on run-time, each request (before instantiating the root Vue.js Application) Middleware before rendering page/pages - universal serverMiddleware runs only on the server - before processing requests
  • 32. Plugins ● Live in the plugins directory and re configured in nuxt.config.js ● Can be limited to client or server side by file-name or config ● Typical use-cases are: ○ Inject $helpers into $context - e.g. $drupalCe ○ Add Vue plugins to the application e.g. Vue.use(VToolTip) ○ Customize external packages. e.g. add Axios interceptors
  • 34. Nuxt2 -> Vue2 ● Nuxt 2 (stable) uses Vue 2 ● Vue3 is stable ○ but not yet default ○ provides vue2 compatibility and upgrade tools ● Nuxt3 is coming and switches to Vue3 ○ will take time to become stable ● Nuxt2 is good for starting new projects!
  • 35. Nuxt3 features ● Composition API ● Webpack5 and/or Vite support ● Nuxt Nitro ● Nuxt Bridge
  • 37. Resources ● https://nuxtjs.org/ ○ Getting started ○ https://nuxtjs.org/modules ○ Nuxt 3 ● Discord Nuxt.js ● https://druxtjs.org ● https://stack.lupus.digital
  • 38. What did you think? Have a look at the session description below and take the survey for each session: https://events.drupal.org/europe2021/schedule/all