Skip to content

Commit b200e05

Browse files
committed
feat(@angular/cli): adapt template using tailwind
1 parent cb24c24 commit b200e05

File tree

2 files changed

+25
-14
lines changed

2 files changed

+25
-14
lines changed

packages/schematics/angular/application/files/common-files/src/app/app__suffix__.html.template

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
--gray-900: oklch(19.37% 0.006 300.98);
2020
--gray-700: oklch(36.98% 0.014 302.71);
2121
--gray-400: oklch(70.9% 0.015 304.04);
22-
22+
<% if (!tailwind) { %>
2323
--red-to-pink-to-purple-vertical-gradient: linear-gradient(
2424
180deg,
2525
var(--orange-red) 0%,
@@ -35,15 +35,17 @@
3535
);
3636

3737
--pill-accent: var(--bright-blue);
38-
38+
<% } %>
3939
font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
4040
Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji",
4141
"Segoe UI Symbol";
42+
<% if (!tailwind) { %>
4243
box-sizing: border-box;
4344
-webkit-font-smoothing: antialiased;
4445
-moz-osx-font-smoothing: grayscale;
46+
<% } %>
4547
}
46-
48+
<% if (!tailwind) { %>
4749
h1 {
4850
font-size: 3.125rem;
4951
color: var(--gray-900);
@@ -180,16 +182,17 @@
180182
margin-block: 1.5rem;
181183
}
182184
}
185+
<% } %>
183186
</style>
184187

185-
<main class="main">
186-
<div class="content">
187-
<div class="left-side">
188+
<main class="<% if (tailwind) { %>flex min-h-full w-full items-center justify-center p-4 antialiased<% } %><% else { %>main<% } %>">
189+
<div class="<% if (tailwind) { %>flex flex-col justify-around max-w-[700px] mb-12 size-max sm:w-full sm:gap-6 sm:flex-row<% } %><% else { %>content<% } %>">
190+
<div class="<% if (tailwind) { %>flex flex-col<% } %><% else { %>left-side<% } %>">
188191
<svg
189192
xmlns="http://www.w3.org/2000/svg"
190193
viewBox="0 0 982 239"
191194
fill="none"
192-
class="angular-logo"
195+
class="<% if (tailwind) { %>max-w-[9.2rem]<% } %><% else { %>angular-logo<% } %>"
193196
>
194197
<g clip-path="url(#a)">
195198
<path
@@ -230,12 +233,12 @@
230233
<clipPath id="a"><path fill="#fff" d="M0 0h982v239H0z" /></clipPath>
231234
</defs>
232235
</svg>
233-
<h1>Hello, {{ title() }}</h1>
234-
<p>Congratulations! Your app is running. 🎉</p>
236+
<h1 <% if (tailwind) { %>class="text-[3.125rem] font-medium leading-none tracking-[-0.125rem] text-[var(--gray-900)] mt-7"<% } %>>Hello, {{ title() }}</h1>
237+
<p <% if (tailwind) { %>class="mt-6 text-[var(--gray-700)]"<% } %>>Congratulations! Your app is running. 🎉</p>
235238
</div>
236-
<div class="divider" role="separator" aria-label="Divider"></div>
237-
<div class="right-side">
238-
<div class="pill-group">
239+
<div class="<% if (tailwind) { %>m:bg-[linear-gradient(180deg,var(--orange-red)_0%,var(--vivid-pink)_50%,var(--electric-violet)_100%)] bg-[linear-gradient(90deg,var(--orange-red)_0%,var(--vivid-pink)_50%,var(--electric-violet)_100%)] sm:w-px mx-2 sm:h-auto h-px sm:w-px w-full sm:my-0 my-6<% } %><% else { %>divider<% } %>" role="separator" aria-label="Divider"></div>
240+
<div class="<% if (tailwind) { %>flex flex-col<% } %><% else { %>right-side<% } %>">
241+
<div class="<% if (tailwind) { %>flex flex-col items-start gap-5<% } %><% else { %>pill-group<% } %>">
239242
@for (item of [
240243
{ title: 'Explore the Docs', link: 'https://angular.dev' },
241244
{ title: 'Learn with Tutorials', link: 'https://angular.dev/tutorials' },
@@ -245,13 +248,14 @@
245248
{ title: 'Angular DevTools', link: 'https://angular.dev/tools/devtools' },
246249
]; track item.title) {
247250
<a
248-
class="pill"
251+
class="<% if (tailwind) { %>group inline-flex items-center gap-1 rounded-full px-3 py-1.5 text-sm font-medium transition [--pill-accent:var(--bright-blue)] nth-[6n+1]:[--pill-accent:var(--bright-blue)] nth-[6n+2]:[--pill-accent:var(--electric-violet)] nth-[6n+3]:[--pill-accent:var(--french-violet)] nth-[6n+4]:[--pill-accent:var(--hot-red)] nth-[6n+5]:[--pill-accent:var(--hot-red)] nth-[6n+6]:[--pill-accent:var(--hot-red)] text-[var(--pill-accent)] bg-[color-mix(in_srgb,var(--pill-accent)_5%,transparent)] hover:bg-[color-mix(in_srgb,var(--pill-accent)_15%,transparent)]<% } %><% else { %>pill<% } %>"
249252
[href]="item.link"
250253
target="_blank"
251254
rel="noopener"
252255
>
253256
<span>{{ item.title }}</span>
254257
<svg
258+
<% if (tailwind) { %>class="ml-1"<% } %>
255259
xmlns="http://www.w3.org/2000/svg"
256260
height="14"
257261
viewBox="0 -960 960 960"
@@ -265,14 +269,16 @@
265269
</a>
266270
}
267271
</div>
268-
<div class="social-links">
272+
<div class="<% if (tailwind) { %>mt-6 flex items-center gap-3<% } %><% else { %>social-links<% } %>">
269273
<a
274+
<% if (tailwind) { %>class="group"<% } %>
270275
href="https://github.com/angular/angular"
271276
aria-label="Github"
272277
target="_blank"
273278
rel="noopener"
274279
>
275280
<svg
281+
<% if (tailwind) { %>class="fill-[var(--gray-400)] group-hover:fill-[var(--gray-900)] transition"<% } %>
276282
width="25"
277283
height="24"
278284
viewBox="0 0 25 24"
@@ -286,12 +292,14 @@
286292
</svg>
287293
</a>
288294
<a
295+
<% if (tailwind) { %>class="group"<% } %>
289296
href="https://x.com/angular"
290297
aria-label="X"
291298
target="_blank"
292299
rel="noopener"
293300
>
294301
<svg
302+
<% if (tailwind) { %>class="fill-[var(--gray-400)] group-hover:fill-[var(--gray-900)] transition"<% } %>
295303
width="24"
296304
height="24"
297305
viewBox="0 0 24 24"
@@ -305,12 +313,14 @@
305313
</svg>
306314
</a>
307315
<a
316+
<% if (tailwind) { %>class="group"<% } %>
308317
href="https://www.youtube.com/channel/UCbn1OgGei-DV7aSRo_HaAiw"
309318
aria-label="Youtube"
310319
target="_blank"
311320
rel="noopener"
312321
>
313322
<svg
323+
<% if (tailwind) { %>class="fill-[var(--gray-400)] group-hover:fill-[var(--gray-900)] transition"<% } %>
314324
width="29"
315325
height="20"
316326
viewBox="0 0 29 20"

packages/schematics/angular/application/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ export default function (options: ApplicationOptions): Rule {
136136
folderName,
137137
suffix,
138138
testRunner: options.testRunner,
139+
tailwind: isTailwind
139140
}),
140141
move(appDir),
141142
]),

0 commit comments

Comments
 (0)