Installation
Follow the procedures below to install and configure your dependencies.
Vue 3
Create a new Vue 3 project
Start by creating a new Vue 3 project by running the command below in your terminal:
npm create vue@latestyarn dlx create-vue@latestpnpm create vue@latestbun create vue@latestThis command will install and execute create-vue, the official Vue project scaffolding tool. Select your preferred options from the prompts.
Tailwind
Install Tailwindcss and its peer dependencies:
npm install -D tailwindcss postcss autoprefixeryarn add -D tailwindcss postcss autoprefixerpnpm add -D tailwindcss postcss autoprefixerbun add -D tailwindcss postcss autoprefixerThen generate your tailwind.config.js and postcss.config.js files by running the command below:
npx tailwindcss init -pConfigure your template paths by adding the following to your tailwind.config.js file:
/** @type {import('tailwindcss').Config} */
export default {
content: [
"./index.html",
"./src/**/*.{vue,js,ts,jsx,tsx}",
],
theme: {
extend: {},
},
plugins: [],
}Add the @tailwind directives for each of Tailwind’s layers to your ./src/assets/css/tailwind.css file.
@tailwind base;
@tailwind components;
@tailwind utilities;Install @vueuse/motion
Install the @vueuse/motion library by running the command below in your terminal:
npm install @vueuse/motionyarn add @vueuse/motionpnpm add @vueuse/motionbun add @vueuse/motionThen configure it in your main.ts or main.js file as shown below:
import { createApp } from "vue";
import "./assets/css/tailwind.css";
import App from "./App.vue";
import { MotionPlugin } from '@vueuse/motion'
const app = createApp(App)
app.use(MotionPlugin)
app.mount("#app");Install Clsx and Tailwind Merge
Install clsx and tailwind-merge by running the command below in your terminal:
npm install clsx tailwind-mergeyarn add clsx tailwind-mergepnpm add clsx tailwind-mergebun add clsx tailwind-mergeThen, in your ./src/lib/utils.ts file, configure it as shown below:
import { type ClassValue, clsx } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}Nuxt 3
Create a new Nuxt 3 project
Start by creating a new Nuxt 3 project by running the command below in your terminal:
npx nuxi@latest init <your-project-name>Tailwind
Install the @nuxtjs/tailwindcss module by running the command below in your terminal:
npx nuxi@latest module add tailwindcssnpm install -D @nuxtjs/tailwindcssyarn add -D @nuxtjs/tailwindcsspnpm i -D @nuxtjs/tailwindcssbun add -D @nuxtjs/tailwindcssIf the modules array is not populated with the @nuxtjs/tailwindcss module, go ahead and add it as shown below:
export default defineNuxtConfig({
modules: ['@nuxtjs/tailwindcss']
})Generate the tailwind.config.js file by running the command below:
npx tailwindcss initThe add the @tailwind directives for each of Tailwind’s layers to your ./assets/css/tailwind.css file.
@tailwind base;
@tailwind components;
@tailwind utilities;then add the following into your nuxt.config.ts file:
export default defineNuxtConfig({
compatibilityDate: "2024-04-03",
devtools: { enabled: true },
modules: ["@nuxtjs/tailwindcss"],
tailwindcss: {
cssPath: ["~/assets/css/tailwind.css", { injectPosition: "first" }],
configPath: "tailwind.config",
exposeConfig: {
level: 2,
},
config: {},
viewer: true,
},
});Install @vueuse/motion
Install the @vueuse/motion library by running the command below in your terminal:
npx nuxi@latest module add @vueuse/motionnpm install @vueuse/motionyarn add @vueuse/motionpnpm add @vueuse/motionbun add @vueuse/motionThen, add the module to the modules array as shown below:
export default defineNuxtConfig({
compatibilityDate: "2024-04-03",
devtools: { enabled: true },
modules: ["@nuxtjs/tailwindcss", "@vueuse/motion/nuxt"],
tailwindcss: {
cssPath: ["~/assets/css/tailwind.css", { injectPosition: "first" }],
configPath: "tailwind.config",
exposeConfig: {
level: 2,
},
config: {},
viewer: true,
},
});Install Clsx and Tailwind Merge
Install clsx and tailwind-merge by running the command below in your terminal:
npm install clsx tailwind-mergeyarn add clsx tailwind-mergepnpm add clsx tailwind-mergebun add clsx tailwind-mergeThen, in your ./lib/utils.ts file, configure it as shown below:
import { type ClassValue, clsx } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}Next step
You can now go ahead and start building your web application 🥳.