Skip to content

Commit 559c0f1

Browse files
committed
guidelines: tailwind: slightly improved tailwind guidelines
1 parent 5c0ff62 commit 559c0f1

File tree

3 files changed

+51
-1
lines changed

3 files changed

+51
-1
lines changed

.ai/tailwindcss/3/core.blade.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- Always use Tailwind CSS v3, verify you're using only supported classes.
2+
- Use the `search-docs` tool to find exactly what's supported in this project's Tailwind setup.

.ai/tailwindcss/4/core.blade.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
- Always use Tailwind CSS v4, do not use the deprecated utilities.
2+
- Use the `search-docs` tool to find exactly what's supported in this project's Tailwind setup.
3+
- In Tailwind v4 you import Tailwind using a regular CSS `@import` statement, not using the `@tailwind` directives used in v3:
4+
@verbatim
5+
<code-snippet name="Tailwind v4 import tailwind diff" lang="diff"
6+
- @tailwind base;
7+
- @tailwind components;
8+
- @tailwind utilities;
9+
+ @import "tailwindcss";
10+
</code-snippet>
11+
@endverbatim
12+
- `corePlugins` is not supported in v4.
13+
14+
## Replaced utilities
15+
- Tailwind v4 removed deprecated utilities. Do not use the deprecated option, use the replacement.
16+
- Opacity values are still numeric.
17+
18+
| Deprecated | Replacement |
19+
|------------+--------------|
20+
| bg-opacity-* | bg-black/* |
21+
| text-opacity-* | text-black/* |
22+
| border-opacity-* | border-black/* |
23+
| divide-opacity-* | divide-black/* |
24+
| ring-opacity-* | ring-black/* |
25+
| placeholder-opacity-* | placeholder-black/* |
26+
| flex-shrink-* | shrink-* |
27+
| flex-grow-* | grow-* |
28+
| overflow-ellipsis | text-ellipsis |
29+
| decoration-slice | box-decoration-slice |
30+
| decoration-clone | box-decoration-clone |
31+

.ai/tailwindcss/core.blade.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,18 @@
1-
- If existing pages and components support dark mode, new pages and components must support dark mode in a similar way.
1+
- Use Tailwind CSS classes to style HTML, check and use existing tailwind conventions within the project before writing your own.
2+
- Offer to extract repeated patterns into components that match the project's conventions (i.e. Blade, JSX, Vue, etc..)
3+
- Think through class placement, order, priority, and defaults - remove redundant classes, add classes to parent or child carefully to limit repetition, group elements logically
4+
5+
## Spacing
6+
- Use gap utilities for spacing, don't use margins
7+
@verbatim
8+
<code-snippet name="Valid Flex gap spacing example" lang="html">
9+
<div class="flex gap-8">
10+
<div>Superior</div>
11+
<div>Michigan</div>
12+
<div>Erie</div>
13+
</div>
14+
</code-snippet>
15+
@endverbatim
16+
17+
## Tailwind Dark Mode
18+
- If existing pages and components support dark mode, new pages and components must support dark mode in a similar way, typically using `dark:`.

0 commit comments

Comments
 (0)