79686801

Date: 2025-07-02 03:58:38
Score: 0.5
Natty:
Report link

Some rule changed with Tailwindcss V4.

V4 Angular init tutorials with CSS file, and use tailwindcss/postcss plugin.

Different vs V3

  1. V4 not include/create tailwindcss.config.js file default, v4 need .postcss.json in Angular higher ver

  2. V4 tutorial with styles.css in Angular project root, not styles.scss. so some usage changed.

  3. styles.css need add @import "tailwindcss"; not like v3 add some "@tailwindcss "xxx"; "

  4. V4 with CSS file in Angular Component, need add other statement: "@import "tailwindcss"" if you want to use @apply

  5. The "dark" mode in manual setting, the tailwindcss v4 need add "@custom-variant dark (&:where(.dark, .dark *));" this statement in styles.css;

  6. But if you want to use dark: in other component (lazy routing or lazy component), you must add "@import "tailwindcss";" in other css file(.css) and muse add "@custom-variant dark (&:where(.dark, .dark *));" again.

Add TailwindCSS v4 in Angular Higher Version flows:

Reasons:
  • Long answer (-1):
  • Has code block (-0.5):
  • User mentioned (1): @import
  • User mentioned (0): @apply
  • Low reputation (1):
Posted by: xhzhang zhang