Skip to content

Commit 9a2d97c

Browse files
authoredJan 24, 2022
[examples] Add new Tailwind CSS Prettier plugin to example (#33614)
## Documentation / Examples - [x] Make sure the linting passes by running `yarn lint` This PR adds the new official plugin for class sorting from Tailwind Labs to the Tailwind example. Rel: https://tailwindcss.com/blog/automatic-class-sorting-with-prettier
1 parent 562439d commit 9a2d97c

File tree

3 files changed

+19
-10
lines changed

3 files changed

+19
-10
lines changed
 

‎examples/with-tailwindcss/package.json

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
"@types/react": "17.0.38",
1616
"autoprefixer": "^10.4.0",
1717
"postcss": "^8.4.5",
18+
"prettier": "^2.5.1",
19+
"prettier-plugin-tailwindcss": "^0.1.1",
1820
"tailwindcss": "^3.0.7",
1921
"typescript": "4.5.4"
2022
}

‎examples/with-tailwindcss/pages/index.tsx

+10-10
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ import Head from 'next/head'
22

33
export default function Home() {
44
return (
5-
<div className="flex flex-col items-center justify-center min-h-screen py-2">
5+
<div className="flex min-h-screen flex-col items-center justify-center py-2">
66
<Head>
77
<title>Create Next App</title>
88
<link rel="icon" href="/favicon.ico" />
99
</Head>
1010

11-
<main className="flex flex-col items-center justify-center w-full flex-1 px-20 text-center">
11+
<main className="flex w-full flex-1 flex-col items-center justify-center px-20 text-center">
1212
<h1 className="text-6xl font-bold">
1313
Welcome to{' '}
1414
<a className="text-blue-600" href="https://nextjs.org">
@@ -18,15 +18,15 @@ export default function Home() {
1818

1919
<p className="mt-3 text-2xl">
2020
Get started by editing{' '}
21-
<code className="p-3 font-mono text-lg bg-gray-100 rounded-md">
21+
<code className="rounded-md bg-gray-100 p-3 font-mono text-lg">
2222
pages/index.tsx
2323
</code>
2424
</p>
2525

26-
<div className="flex flex-wrap items-center justify-around max-w-4xl mt-6 sm:w-full">
26+
<div className="mt-6 flex max-w-4xl flex-wrap items-center justify-around sm:w-full">
2727
<a
2828
href="https://nextjs.org/docs"
29-
className="p-6 mt-6 text-left border w-96 rounded-xl hover:text-blue-600 focus:text-blue-600"
29+
className="mt-6 w-96 rounded-xl border p-6 text-left hover:text-blue-600 focus:text-blue-600"
3030
>
3131
<h3 className="text-2xl font-bold">Documentation &rarr;</h3>
3232
<p className="mt-4 text-xl">
@@ -36,7 +36,7 @@ export default function Home() {
3636

3737
<a
3838
href="https://nextjs.org/learn"
39-
className="p-6 mt-6 text-left border w-96 rounded-xl hover:text-blue-600 focus:text-blue-600"
39+
className="mt-6 w-96 rounded-xl border p-6 text-left hover:text-blue-600 focus:text-blue-600"
4040
>
4141
<h3 className="text-2xl font-bold">Learn &rarr;</h3>
4242
<p className="mt-4 text-xl">
@@ -46,7 +46,7 @@ export default function Home() {
4646

4747
<a
4848
href="https://github.com/vercel/next.js/tree/canary/examples"
49-
className="p-6 mt-6 text-left border w-96 rounded-xl hover:text-blue-600 focus:text-blue-600"
49+
className="mt-6 w-96 rounded-xl border p-6 text-left hover:text-blue-600 focus:text-blue-600"
5050
>
5151
<h3 className="text-2xl font-bold">Examples &rarr;</h3>
5252
<p className="mt-4 text-xl">
@@ -56,7 +56,7 @@ export default function Home() {
5656

5757
<a
5858
href="https://vercel.com/import?filter=next.js&utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
59-
className="p-6 mt-6 text-left border w-96 rounded-xl hover:text-blue-600 focus:text-blue-600"
59+
className="mt-6 w-96 rounded-xl border p-6 text-left hover:text-blue-600 focus:text-blue-600"
6060
>
6161
<h3 className="text-2xl font-bold">Deploy &rarr;</h3>
6262
<p className="mt-4 text-xl">
@@ -66,15 +66,15 @@ export default function Home() {
6666
</div>
6767
</main>
6868

69-
<footer className="flex items-center justify-center w-full h-24 border-t">
69+
<footer className="flex h-24 w-full items-center justify-center border-t">
7070
<a
7171
className="flex items-center justify-center"
7272
href="https://vercel.com?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
7373
target="_blank"
7474
rel="noopener noreferrer"
7575
>
7676
Powered by{' '}
77-
<img src="/vercel.svg" alt="Vercel Logo" className="h-4 ml-2" />
77+
<img src="/vercel.svg" alt="Vercel Logo" className="ml-2 h-4" />
7878
</a>
7979
</footer>
8080
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
arrowParens: 'always',
3+
singleQuote: true,
4+
tabWidth: 2,
5+
semi: false,
6+
tailwindConfig: './tailwind.config.js',
7+
}

0 commit comments

Comments
 (0)
Please sign in to comment.