Skip to content

Commit 216342e

Browse files
authored
Merge pull request #27 from laravel/guidelines/tailwind
Guidelines/tailwind
2 parents 01f5d08 + 5acf32b commit 216342e

File tree

8 files changed

+151
-82
lines changed

8 files changed

+151
-82
lines changed

.ai/core.blade.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
## Conventions
1717
- You must follow all existing code conventions used in this project. When creating or editing a file, check sibling files for the correct structure, approach, naming.
1818
- Use descriptive names. For example, `isRegisteredForDiscounts` not `discount()`.
19+
- Check for existing components to reuse before writing one anew.
1920

2021
## Verification Scripts
2122
- Do not create verification scripts or tinker when tests cover that functionality and prove it works. Unit and feature tests are more important.

.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:`.

art/boost.svg

Lines changed: 85 additions & 56 deletions
Loading

src/Console/InstallCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ private function enactMcpServers(): void
513513
try {
514514
$result = $ide->installMcp(
515515
key: 'herd',
516-
command: PHP_BINARY,
516+
command: 'php',
517517
args: [$this->herd->mcpPath()],
518518
env: ['SITE_PATH' => base_path()]
519519
);

src/Install/Herd.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function mcpPath(): string
4141
return $this->getHomePath().'/.config/herd/bin/herd-mcp.phar';
4242
}
4343

44-
return $this->getHomePath().'/Library/Application Support/Herd/bin/herd-mcp.phar';
44+
return '/Applications/Herd.app/Contents/Resources/herd-mcp.phar';
4545
}
4646

4747
public function isWindowsPlatform(): bool

tests/Unit/Install/HerdTest.php

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -67,22 +67,11 @@ function getHerdTestTempDir(): string
6767
return $herdTestCleanupData['tempDir'];
6868
}
6969

70-
test('mcpPath builds correct path from HOME on non-Windows', function () {
71-
$testHome = getHerdTestTempDir().'/home';
72-
mkdir($testHome, 0755, true);
73-
$_SERVER['HOME'] = $testHome;
74-
75-
$herd = new Herd();
76-
$expected = $testHome.'/Library/Application Support/Herd/bin/herd-mcp.phar';
77-
78-
expect($herd->mcpPath())->toBe($expected);
79-
})->skipOnWindows();
80-
8170
test('mcpPath builds correct Windows path from USERPROFILE when HOME missing', function () {
8271
unset($_SERVER['HOME']);
8372
$_SERVER['USERPROFILE'] = 'C:\\Users\\TestUser';
8473

85-
$herd = new Herd();
74+
$herd = new Herd;
8675
$expected = 'C:/Users/TestUser/.config/herd/bin/herd-mcp.phar';
8776

8877
expect($herd->mcpPath())->toBe($expected);
@@ -93,7 +82,7 @@ function getHerdTestTempDir(): string
9382
mkdir($testHome, 0755, true);
9483
$_SERVER['HOME'] = $testHome;
9584

96-
$herd = new Herd();
85+
$herd = new Herd;
9786

9887
expect($herd->isMcpAvailable())->toBeFalse();
9988
});
@@ -103,7 +92,7 @@ function getHerdTestTempDir(): string
10392
mkdir($testHome, 0755, true);
10493
$_SERVER['HOME'] = $testHome;
10594

106-
$herd = new Herd();
95+
$herd = new Herd;
10796
$mcpPath = $herd->mcpPath();
10897

10998
$mcpDir = dirname($mcpPath);
@@ -112,14 +101,14 @@ function getHerdTestTempDir(): string
112101
file_put_contents($mcpPath, 'test phar content');
113102

114103
expect($herd->isMcpAvailable())->toBeTrue();
115-
});
104+
})->onlyOnWindows();
116105

117106
test('isMcpAvailable returns false after MCP file is removed', function () {
118107
$testHome = getHerdTestTempDir().'/home';
119108
mkdir($testHome, 0755, true);
120109
$_SERVER['HOME'] = $testHome;
121110

122-
$herd = new Herd();
111+
$herd = new Herd;
123112
$mcpPath = $herd->mcpPath();
124113

125114
$mcpDir = dirname($mcpPath);
@@ -132,14 +121,14 @@ function getHerdTestTempDir(): string
132121
unlink($mcpPath);
133122

134123
expect($herd->isMcpAvailable())->toBeFalse();
135-
});
124+
})->onlyOnWindows();
136125

137126
test('getHomePath returns HOME on non-Windows', function () {
138127
$testHome = getHerdTestTempDir().'/home';
139128
mkdir($testHome, 0755, true);
140129
$_SERVER['HOME'] = $testHome;
141130

142-
$herd = new Herd();
131+
$herd = new Herd;
143132

144133
expect($herd->getHomePath())->toBe($testHome);
145134
})->skipOnWindows();
@@ -148,7 +137,7 @@ function getHerdTestTempDir(): string
148137
unset($_SERVER['HOME']);
149138
$_SERVER['USERPROFILE'] = 'C:\\Users\\TestUser';
150139

151-
$herd = new Herd();
140+
$herd = new Herd;
152141

153142
expect($herd->getHomePath())->toBe('C:/Users/TestUser');
154143
})->onlyOnWindows();
@@ -161,7 +150,7 @@ function getHerdTestTempDir(): string
161150
$configDir = $testHome.'/.config/herd';
162151
mkdir($configDir, 0755, true);
163152

164-
$herd = new Herd();
153+
$herd = new Herd;
165154

166155
expect($herd->isInstalled())->toBeTrue();
167156
})->onlyOnWindows();
@@ -171,19 +160,19 @@ function getHerdTestTempDir(): string
171160
mkdir($testHome, 0755, true);
172161
$_SERVER['HOME'] = $testHome;
173162

174-
$herd = new Herd();
163+
$herd = new Herd;
175164

176165
expect($herd->isInstalled())->toBeFalse();
177166
})->onlyOnWindows();
178167

179168
test('isWindowsPlatform returns true on Windows', function () {
180-
$herd = new Herd();
169+
$herd = new Herd;
181170

182171
expect($herd->isWindowsPlatform())->toBeTrue();
183172
})->onlyOnWindows();
184173

185174
test('isWindowsPlatform returns false on non-Windows platforms', function () {
186-
$herd = new Herd();
175+
$herd = new Herd;
187176

188177
expect($herd->isWindowsPlatform())->toBeFalse();
189178
})->skipOnWindows();

0 commit comments

Comments
 (0)