You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _posts/2025-02-09-angular-19-tailwind-4-and-scss-a-modern-step-by-step-setup-guide.md
+13-9Lines changed: 13 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,8 +7,12 @@ image:
7
7
alt: Crafting Cosmic Web Designs!
8
8
---
9
9
10
-
11
-
10
+
> **Heads up: this guide targets Angular 19.**
11
+
>
12
+
> Since Angular 21 the CLI does the setup for you `ng new --style tailwind` replaces most of the steps below.
13
+
>
14
+
> If you are starting a new project, read [Angular 22 + Tailwind 4 + daisyUI Setup: Two Commands](https://www.pacyfist.dev/posts/angular-22-tailwind-4-daisyui-setup/) instead.
15
+
> {: .prompt-warning }
12
16
13
17
There are already several guides on setting up Angular 19 with Tailwind 4, so why another one? Because I despise CSS and always configure Angular with SCSS instead. That small change allows for much cleaner and more readable styles. Unfortunately, every guide I could find used plain old CSS. It makes sense, since the whole idea of Tailwind is to minimize writing CSS, but I still want SCSS, and that's final!
14
18
@@ -77,11 +81,12 @@ Time to [configure](https://github.com/postcss/postcss-load-config) PostCSS. In
77
81
78
82
```json
79
83
{
80
-
"plugins": {
81
-
"@tailwindcss/postcss": {}
82
-
}
84
+
"plugins": {
85
+
"@tailwindcss/postcss": {}
86
+
}
83
87
}
84
88
```
89
+
85
90
## Import Tailwind CSS Styles
86
91
87
92
### Import Tailwind Directives in styles.scss
@@ -90,7 +95,6 @@ Here, we must do something slightly different because we've chosen SCSS. Other t
90
95
91
96
Open the `src/styles.scss` file in your project (this is your global stylesheet) and add the following line:
92
97
93
-
94
98
```css
95
99
@use "tailwindcss";
96
100
```
@@ -118,15 +122,16 @@ Update your `src/styles.scss` file to include the DaisyUI plugin:
118
122
119
123
Now, unfortunately, things get a little quirky. My VS Code keeps showing me a warning: `Unknown at rule @pluginscss(unknownAtRules)`, but that's it. Styles from DaisyUI work fine, so, for the moment, I'm comfortable ignoring this warning.
120
124
121
-
122
125
## Testing configuration
123
126
124
127
If we modify the `src/app/app.component.html` file like this:
0 commit comments