Nuxt 3 - Vue based Web Framework¶
Nuxt is a web framework build on Vue.js. It provides a number of features which speeds up development over standard Vue.js.
Technology used for full stack development
Front end technology stack¶
Technology | Purpose |
---|---|
nuxt 3 | Vue.js based framework |
vite | Frontend tooling |
vitest | Test framework (jest compatible) |
pinia | Vue store for state management |
vuetify | Vue component framework |
VueUse | Collection of Vue Composition utilities |
Front end project start and config¶
npx nuxi init test-project
cd test-project
npm install
Integrate Vuetify in the project¶
npm install vuetify@next @mdi/font sass
- start code editor (
code ,
) - create a folder in the project root named plugins
-
create a file in the plugins folder named vuetify.ts with the following content:
5. modify the nuxi.config.ts file to integrated Vuetify into the Nuxt build process, update the defineNuxtConfig object definition so it looks like:// plugins/vuetify.ts import { createVuetify } from 'vuetify' import * as components from 'vuetify/components' import * as directives from 'vuetify/directives' export default defineNuxtPlugin(nuxtApp => { const vuetify = createVuetify({ components, directives, }) nuxtApp.vueApp.use(vuetify) })
export default defineNuxtConfig({ css: [ 'vuetify/lib/styles/main.sass', '@mdi/font/css/materialdesignicons.min.css' ], build: { transpile: ['vuetify'], }, vite: { define: { 'process.env.DEBUG': false, }, }, })
Add VueUse utilities¶
npm i -D @vueuse/nuxt
-
Edit the nuxt.config.ts file and add the @vueuse/nuxt module:
export default defineNuxtConfig({ modules: [ '@vueuse/nuxt' ], ... })
Add test tooling¶
npm i -D vitest @vue/test-utils@next @vitest/coverage-c8 @vitest/ui
-
Update package.json to add test runner commands. In the scripts section add the following lines:
... "scripts": { "test": "vitest", "coverage": "vitest run --coverage", "test-watch": "vitest -w --ui --open --coverage", ... }, ... }