@ryleigh
To configure Tailwind CSS in Nuxt.js, you can follow these steps:
- Install Tailwind CSS and its dependencies:
1
|
npm install tailwindcss postcss@latest autoprefixer@latest
|
- Create a tailwind.config.js file at the root of your project:
- Create a postcss.config.js file at the root of your project and add the following code:
1
2
3
4
5
6
|
module.exports = {
plugins: [
'tailwindcss',
'autoprefixer',
],
}
|
- Import Tailwind CSS styles in your main CSS file. For example, you can create a assets/css/tailwind.css file and import Tailwind CSS styles like this:
1
2
3
|
@tailwind base;
@tailwind components;
@tailwind utilities;
|
- Update your nuxt.config.js file to add the necessary plugins and configurations for Tailwind CSS. Here's an example:
1
2
3
4
5
6
|
export default {
// Add the Tailwind CSS module to the buildModules array
buildModules: [
'@nuxtjs/tailwindcss',
],
}
|
- Restart your Nuxt.js development server to apply the changes.
Now you should be able to use Tailwind CSS classes in your Nuxt.js project. You can start adding Tailwind CSS classes to your Vue components or HTML templates to style your application.