SlideShare a Scribd company logo
1 of 38
Download to read offline
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
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
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/
Nuxt Components Discovery
● Auto-import used components
● Lazy loading (Async components)
● Production code-splitting
Enable via nuxt.config.js:
export default {
components: true
}
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
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

Javascript ui for rest services
Javascript ui for rest servicesJavascript ui for rest services
Javascript ui for rest servicesIoan Eugen Stan
 
Docker Up and Running for Web Developers
Docker Up and Running for Web DevelopersDocker Up and Running for Web Developers
Docker Up and Running for Web DevelopersAmr Fawzy
 
Bundling your front-end with Webpack
Bundling your front-end with WebpackBundling your front-end with Webpack
Bundling your front-end with WebpackDanillo Corvalan
 
Grunt.js and Yeoman, Continous Integration
Grunt.js and Yeoman, Continous IntegrationGrunt.js and Yeoman, Continous Integration
Grunt.js and Yeoman, Continous IntegrationDavid Amend
 
Vue.js
Vue.jsVue.js
Vue.jsBADR
 
Introduction to VueJS & Vuex
Introduction to VueJS & VuexIntroduction to VueJS & Vuex
Introduction to VueJS & VuexBernd Alter
 
Webpack Introduction
Webpack IntroductionWebpack Introduction
Webpack IntroductionAnjali Chawla
 
One step in the future: CSS variables
One step in the future: CSS variablesOne step in the future: CSS variables
One step in the future: CSS variablesGiacomo Zinetti
 
Nuxt.JS Introdruction
Nuxt.JS IntrodructionNuxt.JS Introdruction
Nuxt.JS IntrodructionDavid Ličen
 
Vue Introduction
Vue IntroductionVue Introduction
Vue IntroductionElad Gasner
 
An Introduction to Vuejs
An Introduction to VuejsAn Introduction to Vuejs
An Introduction to VuejsPaddy Lock
 
Frontend Application Architecture, Patterns, and Workflows
Frontend Application Architecture, Patterns, and WorkflowsFrontend Application Architecture, Patterns, and Workflows
Frontend Application Architecture, Patterns, and WorkflowsTreasure Data, Inc.
 
Integrating AngularJS with Drupal 7
Integrating AngularJS with Drupal 7Integrating AngularJS with Drupal 7
Integrating AngularJS with Drupal 7andrewmriley
 
Webpack: your final module bundler
Webpack: your final module bundlerWebpack: your final module bundler
Webpack: your final module bundlerAndrea Giannantonio
 
Vue 淺談前端建置工具
Vue 淺談前端建置工具Vue 淺談前端建置工具
Vue 淺談前端建置工具andyyou
 

What's hot (20)

Javascript ui for rest services
Javascript ui for rest servicesJavascript ui for rest services
Javascript ui for rest services
 
Docker Up and Running for Web Developers
Docker Up and Running for Web DevelopersDocker Up and Running for Web Developers
Docker Up and Running for Web Developers
 
Bundling your front-end with Webpack
Bundling your front-end with WebpackBundling your front-end with Webpack
Bundling your front-end with Webpack
 
Grunt.js and Yeoman, Continous Integration
Grunt.js and Yeoman, Continous IntegrationGrunt.js and Yeoman, Continous Integration
Grunt.js and Yeoman, Continous Integration
 
Vue.js
Vue.jsVue.js
Vue.js
 
Vue js for beginner
Vue js for beginner Vue js for beginner
Vue js for beginner
 
Webpack slides
Webpack slidesWebpack slides
Webpack slides
 
Introduction to VueJS & Vuex
Introduction to VueJS & VuexIntroduction to VueJS & Vuex
Introduction to VueJS & Vuex
 
Webpack Introduction
Webpack IntroductionWebpack Introduction
Webpack Introduction
 
Webpack
WebpackWebpack
Webpack
 
An Intro into webpack
An Intro into webpackAn Intro into webpack
An Intro into webpack
 
One step in the future: CSS variables
One step in the future: CSS variablesOne step in the future: CSS variables
One step in the future: CSS variables
 
Nuxt.JS Introdruction
Nuxt.JS IntrodructionNuxt.JS Introdruction
Nuxt.JS Introdruction
 
Vue Introduction
Vue IntroductionVue Introduction
Vue Introduction
 
An Introduction to Vuejs
An Introduction to VuejsAn Introduction to Vuejs
An Introduction to Vuejs
 
Frontend Application Architecture, Patterns, and Workflows
Frontend Application Architecture, Patterns, and WorkflowsFrontend Application Architecture, Patterns, and Workflows
Frontend Application Architecture, Patterns, and Workflows
 
Integrating AngularJS with Drupal 7
Integrating AngularJS with Drupal 7Integrating AngularJS with Drupal 7
Integrating AngularJS with Drupal 7
 
Webpack: your final module bundler
Webpack: your final module bundlerWebpack: your final module bundler
Webpack: your final module bundler
 
Vue 淺談前端建置工具
Vue 淺談前端建置工具Vue 淺談前端建置工具
Vue 淺談前端建置工具
 
Webpack DevTalk
Webpack DevTalkWebpack DevTalk
Webpack DevTalk
 

Similar to Drupalcon 2021 - Nuxt.js for drupal developers

Lupus Decoupled Drupal - Drupal Austria Meetup - 2023-04.pdf
Lupus Decoupled Drupal - Drupal Austria Meetup - 2023-04.pdfLupus Decoupled Drupal - Drupal Austria Meetup - 2023-04.pdf
Lupus Decoupled Drupal - Drupal Austria Meetup - 2023-04.pdfWolfgangZiegler6
 
Server Side Rendering with Nuxt.js
Server Side Rendering with Nuxt.jsServer Side Rendering with Nuxt.js
Server Side Rendering with Nuxt.jsJessie Barnett
 
Basics of Vue.js 2019
Basics of Vue.js 2019Basics of Vue.js 2019
Basics of Vue.js 2019Paul Bele
 
Introduction to node.js By Ahmed Assaf
Introduction to node.js  By Ahmed AssafIntroduction to node.js  By Ahmed Assaf
Introduction to node.js By Ahmed AssafAhmed Assaf
 
Vuejs and Web components - current state
Vuejs and Web components - current stateVuejs and Web components - current state
Vuejs and Web components - current stateMikhail Kuznetcov
 
The State of the Veil Framework
The State of the Veil FrameworkThe State of the Veil Framework
The State of the Veil FrameworkVeilFramework
 
HTML, CSS & Javascript Architecture (extended version) - Jan Kraus
HTML, CSS & Javascript Architecture (extended version) - Jan KrausHTML, CSS & Javascript Architecture (extended version) - Jan Kraus
HTML, CSS & Javascript Architecture (extended version) - Jan KrausWomen in Technology Poland
 
GWT - Building Rich Internet Applications Using OO Tools
GWT - Building Rich Internet Applications Using OO ToolsGWT - Building Rich Internet Applications Using OO Tools
GWT - Building Rich Internet Applications Using OO Toolsbarciszewski
 
Infrastructure Management in GCP
Infrastructure Management in GCPInfrastructure Management in GCP
Infrastructure Management in GCPDana Hoffman
 
My "Perfect" Toolchain Setup for Grails Projects
My "Perfect" Toolchain Setup for Grails ProjectsMy "Perfect" Toolchain Setup for Grails Projects
My "Perfect" Toolchain Setup for Grails ProjectsGR8Conf
 
JSFest 2019: Technology agnostic microservices at SPA frontend
JSFest 2019: Technology agnostic microservices at SPA frontendJSFest 2019: Technology agnostic microservices at SPA frontend
JSFest 2019: Technology agnostic microservices at SPA frontendVlad Fedosov
 
Introduction to Vue.js DevStaff Meetup 13.02
Introduction to Vue.js  DevStaff Meetup 13.02Introduction to Vue.js  DevStaff Meetup 13.02
Introduction to Vue.js DevStaff Meetup 13.02Paul Bele
 
CON6423: Scalable JavaScript applications with Project Nashorn
CON6423: Scalable JavaScript applications with Project NashornCON6423: Scalable JavaScript applications with Project Nashorn
CON6423: Scalable JavaScript applications with Project NashornMichel Graciano
 
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...JSFestUA
 
Meet Magento Spain 2019 - Our Experience with Magento Cloud
Meet Magento Spain 2019 - Our Experience with Magento CloudMeet Magento Spain 2019 - Our Experience with Magento Cloud
Meet Magento Spain 2019 - Our Experience with Magento CloudLyzun Oleksandr
 

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

Treinamento frontend
Treinamento frontendTreinamento frontend
Treinamento frontend
 
Lupus Decoupled Drupal - Drupal Austria Meetup - 2023-04.pdf
Lupus Decoupled Drupal - Drupal Austria Meetup - 2023-04.pdfLupus Decoupled Drupal - Drupal Austria Meetup - 2023-04.pdf
Lupus Decoupled Drupal - Drupal Austria Meetup - 2023-04.pdf
 
Server Side Rendering with Nuxt.js
Server Side Rendering with Nuxt.jsServer Side Rendering with Nuxt.js
Server Side Rendering with Nuxt.js
 
Basics of Vue.js 2019
Basics of Vue.js 2019Basics of Vue.js 2019
Basics of Vue.js 2019
 
Node.js an Exectutive View
Node.js an Exectutive ViewNode.js an Exectutive View
Node.js an Exectutive View
 
Nightwatch 101 - Salvador Molina
Nightwatch 101 - Salvador MolinaNightwatch 101 - Salvador Molina
Nightwatch 101 - Salvador Molina
 
Introduction to node.js By Ahmed Assaf
Introduction to node.js  By Ahmed AssafIntroduction to node.js  By Ahmed Assaf
Introduction to node.js By Ahmed Assaf
 
Vuejs and Web components - current state
Vuejs and Web components - current stateVuejs and Web components - current state
Vuejs and Web components - current state
 
The State of the Veil Framework
The State of the Veil FrameworkThe State of the Veil Framework
The State of the Veil Framework
 
Nodejs
NodejsNodejs
Nodejs
 
HTML, CSS & Javascript Architecture (extended version) - Jan Kraus
HTML, CSS & Javascript Architecture (extended version) - Jan KrausHTML, CSS & Javascript Architecture (extended version) - Jan Kraus
HTML, CSS & Javascript Architecture (extended version) - Jan Kraus
 
GWT - Building Rich Internet Applications Using OO Tools
GWT - Building Rich Internet Applications Using OO ToolsGWT - Building Rich Internet Applications Using OO Tools
GWT - Building Rich Internet Applications Using OO Tools
 
Infrastructure Management in GCP
Infrastructure Management in GCPInfrastructure Management in GCP
Infrastructure Management in GCP
 
My "Perfect" Toolchain Setup for Grails Projects
My "Perfect" Toolchain Setup for Grails ProjectsMy "Perfect" Toolchain Setup for Grails Projects
My "Perfect" Toolchain Setup for Grails Projects
 
JSFest 2019: Technology agnostic microservices at SPA frontend
JSFest 2019: Technology agnostic microservices at SPA frontendJSFest 2019: Technology agnostic microservices at SPA frontend
JSFest 2019: Technology agnostic microservices at SPA frontend
 
SWT Tech Sharing: Node.js + Redis
SWT Tech Sharing: Node.js + RedisSWT Tech Sharing: Node.js + Redis
SWT Tech Sharing: Node.js + Redis
 
Introduction to Vue.js DevStaff Meetup 13.02
Introduction to Vue.js  DevStaff Meetup 13.02Introduction to Vue.js  DevStaff Meetup 13.02
Introduction to Vue.js DevStaff Meetup 13.02
 
CON6423: Scalable JavaScript applications with Project Nashorn
CON6423: Scalable JavaScript applications with Project NashornCON6423: Scalable JavaScript applications with Project Nashorn
CON6423: Scalable JavaScript applications with Project Nashorn
 
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
 
Meet Magento Spain 2019 - Our Experience with Magento Cloud
Meet Magento Spain 2019 - Our Experience with Magento CloudMeet Magento Spain 2019 - Our Experience with Magento Cloud
Meet Magento Spain 2019 - Our Experience with Magento Cloud
 

Recently uploaded

Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 

Recently uploaded (20)

Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 

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)
  • 9.
  • 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
  • 13.
  • 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/
  • 18.
  • 19. Nuxt Components Discovery ● Auto-import used components ● Lazy loading (Async components) ● Production code-splitting Enable via nuxt.config.js: export default { components: true }
  • 20.
  • 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
  • 36.
  • 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