1
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?

Next.jsでtailwind cssが効かない原因😭

Last updated at Posted at 2024-08-28

解決策

tailwind.config.ts
content: [
        "./pages/**/*.{js,ts,jsx,tsx,mdx}",
        "./components/**/*.{js,ts,jsx,tsx,mdx}",
        "./app/**/*.{js,ts,jsx,tsx,mdx}",
        //!!追加忘れているかも!!
        "./features/**/*.{js,ts,jsx,tsx,mdx}",
    ],

tailwind.config.tsを見ればおそらく解決します。
昨今のNext.jsプロジェクトにはsrcディレクトリを削除できるオプションがあるかと思います。それにより、今までsrc利用時は下記のようなcontentにより全てのディレクトリ配下でtailwind cssが効いていたのですが、srcディレクトリを採用しない場合、効かなくなってしまいます。

tailwind.config.ts
"./src/**/*.{js,ts,jsx,tsx,mdx}",

自身で追加したディレクトリがcontentに追加されている確認しましょう

1
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
1
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?