Overview:
This article introduces a minimal starter template for Nuxt 3 projects with Tailwind CSS 3. It provides a basic template page as well as an example component from Tailwind UI. The article also explains the steps to create a new Nuxt 3 + Tailwind CSS 3 project.
Features:
- Minimal starter template for Nuxt 3 projects with Tailwind CSS 3.
- Includes a simple template page and a Tailwind UI example component.
- Requires the installation of heroicons for the Tailwind UI component to work.
Installation:
To install the Nuxt 3 + Tailwind CSS 3 project, follow these steps:
Create a new Nuxt 3 project named “hello-tailwind-3” using the command:
npx nuxi init hello-tailwind-3Install Tailwind CSS as a development dependency using the command:
npm install -D tailwindcssCreate a
tailwind.config.jsfile with the following content:npx tailwindcss initOpen the
tailwind.config.jsfile and add the paths to all the template files under “content”.Create a new file named
assets/css/tailwind.cssand add the following @tailwind directives for each of Tailwind’s layers.Open the
nuxt.config.jsfile and add the necessary configuration.Replace
app.vuewith a new pagepages/index.vuewith the desired content.Start the app with
npm run devand visithttp://localhost:3000/to see the created page and Tailwind 3 in action.
Summary:
This article provides a minimal starter template for Nuxt 3 projects with Tailwind CSS 3. It includes a simple template page and a Tailwind UI example component. The installation guide explains the steps to create a new Nuxt 3 + Tailwind CSS 3 project. By following the steps, users can set up their project and start using Tailwind CSS 3 in their Nuxt 3 applications.