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

What's hot (20)

PDF
Javascript ui for rest services
Ioan Eugen Stan
 
PDF
Docker Up and Running for Web Developers
Amr Fawzy
 
PPTX
Bundling your front-end with Webpack
Danillo Corvalan
 
PDF
Grunt.js and Yeoman, Continous Integration
David Amend
 
PDF
Vue.js
BADR
 
PPTX
Vue js for beginner
Chandrasekar G
 
PDF
Introduction to VueJS & Vuex
Bernd Alter
 
PPTX
Webpack Introduction
Anjali Chawla
 
PPTX
Webpack
Anjali Chawla
 
PPTX
An Intro into webpack
Squash Apps Pvt Ltd
 
PDF
One step in the future: CSS variables
Giacomo Zinetti
 
PDF
Nuxt.JS Introdruction
David Ličen
 
PPTX
Vue Introduction
Elad Gasner
 
ODP
An Introduction to Vuejs
Paddy Lock
 
PDF
Frontend Application Architecture, Patterns, and Workflows
Treasure Data, Inc.
 
PPT
Integrating AngularJS with Drupal 7
andrewmriley
 
PDF
Webpack: your final module bundler
Andrea Giannantonio
 
PDF
Vue 淺談前端建置工具
andyyou
 
PDF
Webpack DevTalk
Alessandro Bellini
 
Javascript ui for rest services
Ioan Eugen Stan
 
Docker Up and Running for Web Developers
Amr Fawzy
 
Bundling your front-end with Webpack
Danillo Corvalan
 
Grunt.js and Yeoman, Continous Integration
David Amend
 
Vue.js
BADR
 
Vue js for beginner
Chandrasekar G
 
Introduction to VueJS & Vuex
Bernd Alter
 
Webpack Introduction
Anjali Chawla
 
Webpack
Anjali Chawla
 
An Intro into webpack
Squash Apps Pvt Ltd
 
One step in the future: CSS variables
Giacomo Zinetti
 
Nuxt.JS Introdruction
David Ličen
 
Vue Introduction
Elad Gasner
 
An Introduction to Vuejs
Paddy Lock
 
Frontend Application Architecture, Patterns, and Workflows
Treasure Data, Inc.
 
Integrating AngularJS with Drupal 7
andrewmriley
 
Webpack: your final module bundler
Andrea Giannantonio
 
Vue 淺談前端建置工具
andyyou
 
Webpack DevTalk
Alessandro Bellini
 

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

PPTX
Server Side Rendering with Nuxt.js
Jessie Barnett
 
PDF
Supercharge your next Vue app with Nuxt
The Software House
 
PDF
What is Nuxt js A Beginner’s Guide to Modern Vue Development
Elightwalk Technology PVT. LTD.
 
PDF
nuxt-en.pdf
ssuser65180a
 
PDF
Between a SPA and a JAMstack: Building Web Sites with Nuxt/Vue, Strapi and wh...
Adam Khan
 
PDF
Drupal point of vue
David Ličen
 
PDF
nuxt-sample.pdf
ssuser65180a
 
PDF
Nuxtjs cheat-sheet
ValeriaCastillo71
 
PDF
An introduction to nuxt.js
Hunter Jansen
 
PDF
Production Ready Vue Apps With Nuxt.js
SnirShechter
 
PDF
Bringing Interactivity to Your Drupal Site with Node.js Integration
Acquia
 
PDF
Hello world - intro to node js
Refresh Annapolis Valley
 
PPTX
Getting Started with Vuejs
Tarandeep Singh
 
PPTX
Introduction to Node js
Akshay Mathur
 
PDF
Next.js with drupal, the good parts
Taller Negócio Digitais
 
PPTX
After the LAMP, it's time to get MEAN
Jeff Fox
 
PPTX
Nuxt Talk
Sébastien Chopin
 
PDF
Nuxt로 사내서비스 구현하면서 얻은 경험 공유
민환 조
 
KEY
Starting Node
xtylerx
 
PDF
How To Use Server-Side Rendering with Nuxt.js
Andolasoft Inc
 
Server Side Rendering with Nuxt.js
Jessie Barnett
 
Supercharge your next Vue app with Nuxt
The Software House
 
What is Nuxt js A Beginner’s Guide to Modern Vue Development
Elightwalk Technology PVT. LTD.
 
nuxt-en.pdf
ssuser65180a
 
Between a SPA and a JAMstack: Building Web Sites with Nuxt/Vue, Strapi and wh...
Adam Khan
 
Drupal point of vue
David Ličen
 
nuxt-sample.pdf
ssuser65180a
 
Nuxtjs cheat-sheet
ValeriaCastillo71
 
An introduction to nuxt.js
Hunter Jansen
 
Production Ready Vue Apps With Nuxt.js
SnirShechter
 
Bringing Interactivity to Your Drupal Site with Node.js Integration
Acquia
 
Hello world - intro to node js
Refresh Annapolis Valley
 
Getting Started with Vuejs
Tarandeep Singh
 
Introduction to Node js
Akshay Mathur
 
Next.js with drupal, the good parts
Taller Negócio Digitais
 
After the LAMP, it's time to get MEAN
Jeff Fox
 
Nuxt로 사내서비스 구현하면서 얻은 경험 공유
민환 조
 
Starting Node
xtylerx
 
How To Use Server-Side Rendering with Nuxt.js
Andolasoft Inc
 
Ad

Recently uploaded (20)

PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PPTX
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
PDF
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
Ad

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