Skip to content

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:

sh
npm create vue@latest
sh
yarn dlx create-vue@latest
sh
pnpm create vue@latest
sh
bun create vue@latest

This 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:

sh
npm install -D tailwindcss postcss autoprefixer
sh
yarn add -D tailwindcss postcss autoprefixer
sh
pnpm add -D tailwindcss postcss autoprefixer
sh
bun add -D tailwindcss postcss autoprefixer

Then generate your tailwind.config.js and postcss.config.js files by running the command below:

sh
npx tailwindcss init -p

Configure your template paths by adding the following to your tailwind.config.js file:

js
/** @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.css
css
@tailwind base;
@tailwind components;
@tailwind utilities;

Install @vueuse/motion

Install the @vueuse/motion library by running the command below in your terminal:

sh
npm install @vueuse/motion
sh
yarn add @vueuse/motion
sh
pnpm add @vueuse/motion
sh
bun add @vueuse/motion

Then configure it in your main.ts or main.js file as shown below:

ts
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:

sh
npm install clsx tailwind-merge
sh
yarn add clsx tailwind-merge
sh
pnpm add clsx tailwind-merge
sh
bun add clsx tailwind-merge

Then, in your ./src/lib/utils.ts file, configure it as shown below:

utils.ts
ts
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:

npm
sh
npx nuxi@latest init <your-project-name>

Tailwind

Install the @nuxtjs/tailwindcss module by running the command below in your terminal:

sh
npx nuxi@latest module add tailwindcss
sh
npm install -D @nuxtjs/tailwindcss
sh
yarn add -D @nuxtjs/tailwindcss
sh
pnpm i -D @nuxtjs/tailwindcss
sh
bun add -D @nuxtjs/tailwindcss

If the modules array is not populated with the @nuxtjs/tailwindcss module, go ahead and add it as shown below:

nuxt.config.ts
sh
export default defineNuxtConfig({
  modules: ['@nuxtjs/tailwindcss']
})

Generate the tailwind.config.js file by running the command below:

sh
npx tailwindcss init

The add the @tailwind directives for each of Tailwind’s layers to your ./assets/css/tailwind.css file.

tailwind.css
css
@tailwind base;
@tailwind components;
@tailwind utilities;

then add the following into your nuxt.config.ts file:

nuxt.config.ts
ts
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:

sh
npx nuxi@latest module add @vueuse/motion
sh
npm install @vueuse/motion
sh
yarn add @vueuse/motion
sh
pnpm add @vueuse/motion
sh
bun add @vueuse/motion

Then, add the module to the modules array as shown below:

nuxt.config.ts
ts
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:

sh
npm install clsx tailwind-merge
sh
yarn add clsx tailwind-merge
sh
pnpm add clsx tailwind-merge
sh
bun add clsx tailwind-merge

Then, in your ./lib/utils.ts file, configure it as shown below:

utils.ts
ts
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 🥳.

Released under the MIT License.