Skip to content

Commit 07141b8

Browse files
committed
chore: 添加 tailwind css
Signed-off-by: neil <[email protected]>
1 parent 63bfc1b commit 07141b8

14 files changed

+761
-250
lines changed

.prettierignore

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
.next
2-
.cache
32
node_modules
43
public
5-
package-lock.json
64
yarn.lock

.prettierrc.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
singleQuote: true,
3+
trailingComma: 'es5',
4+
plugins: [require('prettier-plugin-tailwindcss')],
5+
};

.prettierrc.json

-4
This file was deleted.

next.config.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1-
/** @type {import('next').NextConfig} */
1+
const path = require('path');
2+
3+
/** @type {import("next").NextConfig} */
24
const nextConfig = {
35
reactStrictMode: true,
46
swcMinify: true,
7+
output: 'standalone',
8+
sassOptions: {
9+
includePaths: [path.join(__dirname, 'styles')],
10+
},
511
};
612

713
module.exports = nextConfig;

package.json

+22
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,38 @@
1515
"react-dom": "18.2.0"
1616
},
1717
"devDependencies": {
18+
"@tailwindcss/line-clamp": "^0.4.0",
1819
"@types/node": "18.7.13",
1920
"@types/react": "18.0.17",
2021
"@types/react-dom": "18.0.6",
22+
"autoprefixer": "^10.4.8",
2123
"eslint": "8.22.0",
2224
"eslint-config-next": "12.2.5",
2325
"eslint-config-prettier": "^8.5.0",
2426
"eslint-plugin-prettier": "^4.2.1",
2527
"husky": "^8.0.1",
2628
"lint-staged": "^13.0.3",
29+
"postcss": "^8.4.16",
30+
"postcss-flexbugs-fixes": "^5.0.2",
31+
"postcss-preset-env": "^7.8.0",
2732
"prettier": "^2.7.1",
33+
"prettier-plugin-tailwindcss": "^0.1.13",
34+
"sass": "^1.54.5",
35+
"tailwindcss": "^3.1.8",
2836
"typescript": "4.7.4"
37+
},
38+
"browserslist": {
39+
"production": [
40+
"defaults",
41+
"not dead",
42+
"not ie <= 11",
43+
"safari >= 11",
44+
"not op_mini all"
45+
],
46+
"development": [
47+
"last 1 chrome version",
48+
"last 1 firefox version",
49+
"last 1 safari version"
50+
]
2951
}
3052
}

pages/_app.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import '../styles/globals.css';
1+
import '../styles/globals.sass';
22
import type { AppProps } from 'next/app';
33

44
function MyApp({ Component, pageProps }: AppProps) {

pages/api/hello.ts

-13
This file was deleted.

pages/index.tsx

+2-63
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,9 @@
11
import type { NextPage } from 'next';
2-
import Head from 'next/head';
3-
import Image from 'next/image';
4-
import styles from '../styles/Home.module.css';
52

63
const Home: NextPage = () => {
74
return (
8-
<div className={styles.container}>
9-
<Head>
10-
<title>Create Next App</title>
11-
<meta name="description" content="Generated by create next app" />
12-
<link rel="icon" href="/favicon.ico" />
13-
</Head>
14-
15-
<main className={styles.main}>
16-
<h1 className={styles.title}>
17-
Welcome to <a href="https://nextjs.org">Next.js!</a>
18-
</h1>
19-
20-
<p className={styles.description}>
21-
Get started by editing{' '}
22-
<code className={styles.code}>pages/index.tsx</code>
23-
</p>
24-
25-
<div className={styles.grid}>
26-
<a href="https://nextjs.org/docs" className={styles.card}>
27-
<h2>Documentation &rarr;</h2>
28-
<p>Find in-depth information about Next.js features and API.</p>
29-
</a>
30-
31-
<a href="https://nextjs.org/learn" className={styles.card}>
32-
<h2>Learn &rarr;</h2>
33-
<p>Learn about Next.js in an interactive course with quizzes!</p>
34-
</a>
35-
36-
<a
37-
href="https://github.com/vercel/next.js/tree/canary/examples"
38-
className={styles.card}
39-
>
40-
<h2>Examples &rarr;</h2>
41-
<p>Discover and deploy boilerplate example Next.js projects.</p>
42-
</a>
43-
44-
<a
45-
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
46-
className={styles.card}
47-
>
48-
<h2>Deploy &rarr;</h2>
49-
<p>
50-
Instantly deploy your Next.js site to a public URL with Vercel.
51-
</p>
52-
</a>
53-
</div>
54-
</main>
55-
56-
<footer className={styles.footer}>
57-
<a
58-
href="https://vercel.com?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
59-
target="_blank"
60-
rel="noopener noreferrer"
61-
>
62-
Powered by{' '}
63-
<span className={styles.logo}>
64-
<Image src="/vercel.svg" alt="Vercel Logo" width={72} height={16} />
65-
</span>
66-
</a>
67-
</footer>
5+
<div>
6+
<h1 className="text-3xl font-bold underline">Hello world!</h1>
687
</div>
698
);
709
};

postcss.config.js

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module.exports = {
2+
plugins: [
3+
'postcss-flexbugs-fixes',
4+
'tailwindcss',
5+
[
6+
'postcss-preset-env',
7+
{
8+
autoprefixer: {
9+
flexbox: 'no-2009',
10+
},
11+
stage: 3,
12+
features: {
13+
'custom-properties': false,
14+
},
15+
},
16+
],
17+
],
18+
};

styles/Home.module.css

-129
This file was deleted.

styles/globals.css

-26
This file was deleted.

styles/globals.sass

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@import 'tailwindcss/base'
2+
@import 'tailwindcss/components'
3+
@import 'tailwindcss/utilities'

tailwind.config.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/** @type {import('tailwindcss').Config} */
2+
module.exports = {
3+
content: [
4+
'./pages/**/*.{js,ts,jsx,tsx}',
5+
'./common/components/**/*.{js,ts,jsx,tsx}',
6+
'./modules/**/*.{js,ts,jsx,tsx}',
7+
],
8+
theme: {
9+
extend: {},
10+
},
11+
plugins: [require('@tailwindcss/line-clamp')],
12+
};

0 commit comments

Comments
 (0)