Skip to content

Commit cd04606

Browse files
AviAvinavbalazsorban44
andauthoredSep 30, 2022
Add windicss example (vercel#35256)
Adding windicss example. This is my first pull request to next.js, so I am very sorry if I did something wrong. ## Documentation / Examples - [X] Make sure the linting passes by running `yarn lint` Co-authored-by: Balázs Orbán <18369201+balazsorban44@users.noreply.github.com>
1 parent 24f573f commit cd04606

File tree

11 files changed

+234
-0
lines changed

11 files changed

+234
-0
lines changed
 

‎examples/with-windicss/.gitignore

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# next.js
12+
/.next/
13+
/out/
14+
15+
# production
16+
/build
17+
18+
# misc
19+
.DS_Store
20+
*.pem
21+
22+
# debug
23+
npm-debug.log*
24+
yarn-debug.log*
25+
yarn-error.log*
26+
.pnpm-debug.log*
27+
28+
# local env files
29+
.env*.local
30+
31+
# vercel
32+
.vercel
33+
34+
# typescript
35+
*.tsbuildinfo
36+
next-env.d.ts

‎examples/with-windicss/README.md

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Next.js + WindiCSS Example
2+
3+
This example shows how to use [WindiCSS](https://windicss.org/) with Next.js.
4+
5+
## Deploy your own
6+
7+
Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=next-example) or preview live with [StackBlitz](https://stackblitz.com/github/vercel/next.js/tree/canary/examples/hello-world)
8+
9+
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/git/external?repository-url=https://github.com/vercel/next.js/tree/canary/examples/with-windicss&project-name=with-windicss&repository-name=with-windicss)
10+
11+
## How to use
12+
13+
Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
14+
15+
```bash
16+
npx create-next-app --example with-windicss
17+
# or
18+
yarn create next-app --example with-windicss
19+
# or
20+
pnpm create next-app --example with-windicss
21+
```
22+
23+
Deploy it to the cloud with [Vercel](https://vercel.com/new?utm_source=github&utm_medium=readme&utm_campaign=next-example) ([Documentation](https://nextjs.org/docs/deployment)).

‎examples/with-windicss/next.config.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/** @type {import('next').NextConfig} */
2+
const WindiCSSWebpackPlugin = require('windicss-webpack-plugin')
3+
4+
const nextConfig = {
5+
reactStrictMode: true,
6+
webpack: (config) => {
7+
config.plugins.push(new WindiCSSWebpackPlugin())
8+
return config
9+
},
10+
}
11+
12+
module.exports = nextConfig

‎examples/with-windicss/package.json

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"private": true,
3+
"scripts": {
4+
"dev": "next dev",
5+
"build": "next build",
6+
"start": "next start"
7+
},
8+
"dependencies": {
9+
"next": "latest",
10+
"react": "18.2.0",
11+
"react-dom": "18.2.0"
12+
},
13+
"devDependencies": {
14+
"@types/node": "17.0.21",
15+
"@types/react": "17.0.40",
16+
"typescript": "4.6.2",
17+
"windicss": "3.5.1",
18+
"windicss-webpack-plugin": "1.6.7"
19+
}
20+
}

‎examples/with-windicss/pages/_app.tsx

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import '../styles/globals.css'
2+
import type { AppProps } from 'next/app'
3+
import 'windi.css'
4+
5+
function MyApp({ Component, pageProps }: AppProps) {
6+
return <Component {...pageProps} />
7+
}
8+
9+
export default MyApp
+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
import type { NextPage } from 'next'
2+
import Head from 'next/head'
3+
import Image from 'next/image'
4+
5+
const Home: NextPage = () => {
6+
return (
7+
<div className="flex min-h-screen flex-col items-center justify-center py-2">
8+
<Head>
9+
<title>Create Next App</title>
10+
<link rel="icon" href="/favicon.ico" />
11+
</Head>
12+
13+
<main className="flex w-full flex-1 flex-col items-center justify-center px-20 text-center">
14+
<h1 className="text-6xl font-bold">
15+
Welcome to{' '}
16+
<a className="text-blue-600" href="https://nextjs.org">
17+
Next.js!
18+
</a>
19+
</h1>
20+
21+
<p className="mt-3 text-2xl">
22+
Get started by editing{' '}
23+
<code className="rounded-md bg-gray-100 p-3 font-mono text-lg">
24+
pages/index.tsx
25+
</code>
26+
</p>
27+
28+
<div className="mt-6 flex max-w-4xl flex-wrap items-center justify-around sm:w-full">
29+
<a
30+
href="https://nextjs.org/docs"
31+
className="mt-6 w-96 rounded-xl border p-6 text-left hover:text-blue-600 focus:text-blue-600"
32+
>
33+
<h3 className="text-2xl font-bold">Documentation &rarr;</h3>
34+
<p className="mt-4 text-xl">
35+
Find in-depth information about Next.js features and API.
36+
</p>
37+
</a>
38+
39+
<a
40+
href="https://nextjs.org/learn"
41+
className="mt-6 w-96 rounded-xl border p-6 text-left hover:text-blue-600 focus:text-blue-600"
42+
>
43+
<h3 className="text-2xl font-bold">Learn &rarr;</h3>
44+
<p className="mt-4 text-xl">
45+
Learn about Next.js in an interactive course with quizzes!
46+
</p>
47+
</a>
48+
49+
<a
50+
href="https://github.com/vercel/next.js/tree/canary/examples"
51+
className="mt-6 w-96 rounded-xl border p-6 text-left hover:text-blue-600 focus:text-blue-600"
52+
>
53+
<h3 className="text-2xl font-bold">Examples &rarr;</h3>
54+
<p className="mt-4 text-xl">
55+
Discover and deploy boilerplate example Next.js projects.
56+
</p>
57+
</a>
58+
59+
<a
60+
href="https://vercel.com/import?filter=next.js&utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
61+
className="mt-6 w-96 rounded-xl border p-6 text-left hover:text-blue-600 focus:text-blue-600"
62+
>
63+
<h3 className="text-2xl font-bold">Deploy &rarr;</h3>
64+
<p className="mt-4 text-xl">
65+
Instantly deploy your Next.js site to a public URL with Vercel.
66+
</p>
67+
</a>
68+
</div>
69+
</main>
70+
71+
<footer className="flex h-24 w-full items-center justify-center border-t">
72+
<a
73+
className="flex items-center justify-center gap-2"
74+
href="https://vercel.com?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
75+
target="_blank"
76+
rel="noopener noreferrer"
77+
>
78+
Powered by{' '}
79+
<Image src="/vercel.svg" alt="Vercel Logo" width={72} height={16} />
80+
</a>
81+
</footer>
82+
</div>
83+
)
84+
}
85+
86+
export default Home
25.3 KB
Binary file not shown.
+4
Loading
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
html,
2+
body {
3+
padding: 0;
4+
margin: 0;
5+
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
6+
Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
7+
}
8+
9+
a {
10+
color: inherit;
11+
text-decoration: none;
12+
}
13+
14+
* {
15+
box-sizing: border-box;
16+
}

‎examples/with-windicss/tsconfig.json

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es5",
4+
"lib": ["dom", "dom.iterable", "esnext"],
5+
"allowJs": true,
6+
"skipLibCheck": true,
7+
"strict": true,
8+
"forceConsistentCasingInFileNames": true,
9+
"noEmit": true,
10+
"esModuleInterop": true,
11+
"module": "esnext",
12+
"moduleResolution": "node",
13+
"resolveJsonModule": true,
14+
"isolatedModules": true,
15+
"jsx": "preserve",
16+
"incremental": true
17+
},
18+
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
19+
"exclude": ["node_modules"]
20+
}
+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { defineConfig } from 'windicss/helpers'
2+
3+
export default defineConfig({
4+
extract: {
5+
include: ['**/*.{jsx,tsx,css}'],
6+
exclude: ['node_modules', '.git', '.next'],
7+
},
8+
})

0 commit comments

Comments
 (0)
Please sign in to comment.