0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Nuxt.jsでTailwindCSSを使用する際の設定

Last updated at Posted at 2023-12-16

ディレクトリ構成
ディレクトリ構成

TailwindCSSのインストール

npm install -D @nuxtjs/tailwindcss tailwindcss@latest postcss@latest autoprefixer@latest`

tailwind.config.jsの生成

npx tailwindcss init`

./tailwind.config.js

/** @type {import('tailwindcss').Config} */
export default {
  purge: ["./components/*.{vue,js}", "./app.vue", "./nuxt.config.{js,ts}"],
  content: [],
  theme: {
    extend: {},
  },
  plugins: [],
  mode: "jit",
};

./nuxt.config.ts

// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  devtools: { enabled: true },
  css: ["~/assets/css/main.css"],
  postcss: {
    plugins: {
      tailwindcss: {},
      autoprefixer: {},
    },
  },
});

./assets/css/main.css

@tailwind base;
@tailwind components;
@tailwind utilities;
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?