Unverified Commit 8c98a207 authored by Balázs Orbán's avatar Balázs Orbán Committed by GitHub

feat(cli): introduce `--tailwind` flag (#46927)

### What?

This PR introduces a new `--tailwind` flag to the `create-next-app` CLI,
to make it easier to bootstrap a Next.js app with Tailwind CSS
pre-configured. This is going to be the **default**. To opt-out of
Tailwind CSS, you can use the `--no-tailwind` flag.

### Why?

Tailwind CSS is one of the most popular styling solutions right now, and
we would like to make it easier to get started.

Currently, the closest you can come to this is by running `pnpm create
next-app -e with-tailwindcss` which will clone the
https://github.com/vercel/next.js/tree/canary/examples/with-tailwindcss
example. But that example is not configured for the App Router. This PR
will let you add Tailwind CSS to both `app/`, `pages/`, and start out
with TypeScript or JavaScript via the CLI prompts.

(Some community feedback
https://twitter.com/dev_jonaskaas/status/1632367991827443713,
https://twitter.com/samselikoff/status/1634662473331617794)

### How?

We are adding 4 new templates to the CLI bundle.

> Note: The styling is not pixel-perfect compared to the current
templates (using CSS modules) to require fewer overrides, but I tried to
match it as close as possible. Here are a few screenshots:

<details>
<summary><b>Current, light</b></summary>
<img
src="https://user-images.githubusercontent.com/18369201/224733372-9dba86fe-9191-471d-ad9f-ab904c47f544.png"/>
</details>

<details>
<summary><b>Tailwind (new), light</b></summary>
<img
src="https://user-images.githubusercontent.com/18369201/224733610-038d9d0f-634d-4b69-b5c2-a5056b56760c.png"/>
</details>

<details>
<summary><b>Current, dark, responsive</b></summary>
<img
src="https://user-images.githubusercontent.com/18369201/224733790-9b4d730c-0336-4dbe-bc10-1cae1d7fd145.png"/>
</details>

<details>
<summary><b>Tailwind (new), dark, responsive</b></summary>
<img
src="https://user-images.githubusercontent.com/18369201/224734375-28384bbc-2c3a-4125-8f29-c102f3b7aa1d.png"/>
</details>

#### For reviewers

This introduces 4 new templates, with a very similar code base to the
original ones. To keep the PR focused, I decided to copy over duplicate
code, but we could potentially create a shared folder for files that are
the same across templates to somewhat reduce the CLI size. Not sure if
it's worth it, let me know. Probably fine for now, but something to
consider if we are adding more permutations in the future.

---

~Work remaining:~

- [x] app+ts
	- [x] layout
	- [x] dark mode
	- [x] media queries
	- [x] animations
- [x] app+js
- [x] pages+ts
- [x] pages+js
- [x] prompt/config
- [x] deprecate Tailwind CSS example in favor of CLI
- [x] update docs
- [x] add test
- [x] add [Prettier
plugin](https://github.com/tailwindlabs/prettier-plugin-tailwindcss)
 
Closes NEXT-772
Related #45814, #44286
parent 588bf8ee
...@@ -45,9 +45,17 @@ Options: ...@@ -45,9 +45,17 @@ Options:
Initialize as a JavaScript project. Initialize as a JavaScript project.
--tailwind
Initialize with Tailwind CSS config. (default)
--no-tailwind
Initialize without Tailwind CSS config.
--eslint --eslint
Initialize with eslint config. Initialize with ESLint config.
--experimental-app --experimental-app
......
# Next.js + Tailwind CSS Example # Next.js + Tailwind CSS Example
This example shows how to use [Tailwind CSS](https://tailwindcss.com/) [(v3.2)](https://tailwindcss.com/blog/tailwindcss-v3-2) with Next.js. It follows the steps outlined in the official [Tailwind docs](https://tailwindcss.com/docs/guides/nextjs). Tailwind CSS is integrated into the `create-next-app` CLI, which supports TypeScript and JavaScript, as well as the App Router (`app/`) and the pages directory `pages/`.
## Deploy your own
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/with-tailwindcss)
[![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-tailwindcss&project-name=with-tailwindcss&repository-name=with-tailwindcss)
## How to use ## How to use
Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example: Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap a project preconfigured with Tailwind CSS:
```bash ```bash
npx create-next-app --example with-tailwindcss with-tailwindcss-app npx create-next-app --tailwind with-tailwindcss-app
``` ```
```bash ```bash
yarn create next-app --example with-tailwindcss with-tailwindcss-app yarn create next-app --tailwind with-tailwindcss-app
``` ```
```bash ```bash
pnpm create next-app --example with-tailwindcss with-tailwindcss-app pnpm create next-app --tailwind with-tailwindcss-app
``` ```
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)).
{
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
},
"dependencies": {
"next": "latest",
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"@types/node": "18.11.3",
"@types/react": "18.0.21",
"@types/react-dom": "18.0.6",
"autoprefixer": "^10.4.12",
"postcss": "^8.4.18",
"tailwindcss": "^3.2.4",
"typescript": "4.9.4"
}
}
import type { NextPage } from 'next'
import Head from 'next/head'
import Image from 'next/image'
const Home: NextPage = () => {
return (
<div className="flex min-h-screen flex-col items-center justify-center py-2">
<Head>
<title>Create Next App</title>
<link rel="icon" href="/favicon.ico" />
</Head>
<main className="flex w-full flex-1 flex-col items-center justify-center px-20 text-center">
<h1 className="text-6xl font-bold">
Welcome to{' '}
<a className="text-blue-600" href="https://nextjs.org">
Next.js!
</a>
</h1>
<p className="mt-3 text-2xl">
Get started by editing{' '}
<code className="rounded-md bg-gray-100 p-3 font-mono text-lg">
pages/index.tsx
</code>
</p>
<div className="mt-6 flex max-w-4xl flex-wrap items-center justify-around sm:w-full">
<a
href="https://nextjs.org/docs"
className="mt-6 w-96 rounded-xl border p-6 text-left hover:text-blue-600 focus:text-blue-600"
>
<h3 className="text-2xl font-bold">Documentation &rarr;</h3>
<p className="mt-4 text-xl">
Find in-depth information about Next.js features and its API.
</p>
</a>
<a
href="https://nextjs.org/learn"
className="mt-6 w-96 rounded-xl border p-6 text-left hover:text-blue-600 focus:text-blue-600"
>
<h3 className="text-2xl font-bold">Learn &rarr;</h3>
<p className="mt-4 text-xl">
Learn about Next.js in an interactive course with quizzes!
</p>
</a>
<a
href="https://github.com/vercel/next.js/tree/canary/examples"
className="mt-6 w-96 rounded-xl border p-6 text-left hover:text-blue-600 focus:text-blue-600"
>
<h3 className="text-2xl font-bold">Examples &rarr;</h3>
<p className="mt-4 text-xl">
Discover and deploy boilerplate example Next.js projects.
</p>
</a>
<a
href="https://vercel.com/import?filter=next.js&utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
className="mt-6 w-96 rounded-xl border p-6 text-left hover:text-blue-600 focus:text-blue-600"
>
<h3 className="text-2xl font-bold">Deploy &rarr;</h3>
<p className="mt-4 text-xl">
Instantly deploy your Next.js site to a public URL with Vercel.
</p>
</a>
</div>
</main>
<footer className="flex h-24 w-full items-center justify-center border-t">
<a
className="flex items-center justify-center gap-2"
href="https://vercel.com?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
Powered by{' '}
<Image src="/vercel.svg" alt="Vercel Logo" width={72} height={16} />
</a>
</footer>
</div>
)
}
export default Home
<svg width="283" height="64" viewBox="0 0 283 64" fill="none"
xmlns="http://www.w3.org/2000/svg">
<path d="M141.04 16c-11.04 0-19 7.2-19 18s8.96 18 20 18c6.67 0 12.55-2.64 16.19-7.09l-7.65-4.42c-2.02 2.21-5.09 3.5-8.54 3.5-4.79 0-8.86-2.5-10.37-6.5h28.02c.22-1.12.35-2.28.35-3.5 0-10.79-7.96-17.99-19-17.99zm-9.46 14.5c1.25-3.99 4.67-6.5 9.45-6.5 4.79 0 8.21 2.51 9.45 6.5h-18.9zM248.72 16c-11.04 0-19 7.2-19 18s8.96 18 20 18c6.67 0 12.55-2.64 16.19-7.09l-7.65-4.42c-2.02 2.21-5.09 3.5-8.54 3.5-4.79 0-8.86-2.5-10.37-6.5h28.02c.22-1.12.35-2.28.35-3.5 0-10.79-7.96-17.99-19-17.99zm-9.45 14.5c1.25-3.99 4.67-6.5 9.45-6.5 4.79 0 8.21 2.51 9.45 6.5h-18.9zM200.24 34c0 6 3.92 10 10 10 4.12 0 7.21-1.87 8.8-4.92l7.68 4.43c-3.18 5.3-9.14 8.49-16.48 8.49-11.05 0-19-7.2-19-18s7.96-18 19-18c7.34 0 13.29 3.19 16.48 8.49l-7.68 4.43c-1.59-3.05-4.68-4.92-8.8-4.92-6.07 0-10 4-10 10zm82.48-29v46h-9V5h9zM36.95 0L73.9 64H0L36.95 0zm92.38 5l-27.71 48L73.91 5H84.3l17.32 30 17.32-30h10.39zm58.91 12v9.69c-1-.29-2.06-.49-3.2-.49-5.81 0-10 4-10 10V51h-9V17h9v9.2c0-5.08 5.91-9.2 13.2-9.2z" fill="#000"/>
</svg>
\ No newline at end of file
@tailwind base;
@tailwind components;
@tailwind utilities;
...@@ -214,7 +214,7 @@ ...@@ -214,7 +214,7 @@
"styled-jsx": "5.1.1", "styled-jsx": "5.1.1",
"styled-jsx-plugin-postcss": "3.0.2", "styled-jsx-plugin-postcss": "3.0.2",
"swr": "^2.0.0", "swr": "^2.0.0",
"tailwindcss": "1.1.3", "tailwindcss": "3.2.7",
"taskr": "1.1.0", "taskr": "1.1.0",
"tree-kill": "1.2.2", "tree-kill": "1.2.2",
"ts-node": "10.9.1", "ts-node": "10.9.1",
......
...@@ -34,6 +34,7 @@ export async function createApp({ ...@@ -34,6 +34,7 @@ export async function createApp({
example, example,
examplePath, examplePath,
typescript, typescript,
tailwind,
eslint, eslint,
experimentalApp, experimentalApp,
srcDir, srcDir,
...@@ -44,6 +45,7 @@ export async function createApp({ ...@@ -44,6 +45,7 @@ export async function createApp({
example?: string example?: string
examplePath?: string examplePath?: string
typescript: boolean typescript: boolean
tailwind: boolean
eslint: boolean eslint: boolean
experimentalApp: boolean experimentalApp: boolean
srcDir: boolean srcDir: boolean
...@@ -51,7 +53,13 @@ export async function createApp({ ...@@ -51,7 +53,13 @@ export async function createApp({
}): Promise<void> { }): Promise<void> {
let repoInfo: RepoInfo | undefined let repoInfo: RepoInfo | undefined
const mode: TemplateMode = typescript ? 'ts' : 'js' const mode: TemplateMode = typescript ? 'ts' : 'js'
const template: TemplateType = experimentalApp ? 'app' : 'default' const template: TemplateType = experimentalApp
? tailwind
? 'app-tw'
: 'app'
: tailwind
? 'default-tw'
: 'default'
if (example) { if (example) {
let repoUrl: URL | undefined let repoUrl: URL | undefined
...@@ -222,6 +230,7 @@ export async function createApp({ ...@@ -222,6 +230,7 @@ export async function createApp({
mode, mode,
packageManager, packageManager,
isOnline, isOnline,
tailwind,
eslint, eslint,
srcDir, srcDir,
importAlias, importAlias,
......
...@@ -50,6 +50,13 @@ const program = new Commander.Command(packageJson.name) ...@@ -50,6 +50,13 @@ const program = new Commander.Command(packageJson.name)
` `
Initialize as a JavaScript project. Initialize as a JavaScript project.
`
)
.option(
'--tailwind',
`
Initialize with Tailwind CSS config. (default)
` `
) )
.option( .option(
...@@ -222,14 +229,12 @@ async function run(): Promise<void> { ...@@ -222,14 +229,12 @@ async function run(): Promise<void> {
const defaults: typeof preferences = { const defaults: typeof preferences = {
typescript: true, typescript: true,
eslint: true, eslint: true,
tailwind: true,
srcDir: false, srcDir: false,
importAlias: '@/*', importAlias: '@/*',
} }
const getPrefOrDefault = (field: string) => { const getPrefOrDefault = (field: string) =>
return typeof preferences[field] === 'undefined' preferences[field] ?? defaults[field]
? defaults[field]
: preferences[field]
}
if (!program.typescript && !program.javascript) { if (!program.typescript && !program.javascript) {
if (ciInfo.isCI) { if (ciInfo.isCI) {
...@@ -238,7 +243,7 @@ async function run(): Promise<void> { ...@@ -238,7 +243,7 @@ async function run(): Promise<void> {
program.typescript = false program.typescript = false
program.javascript = true program.javascript = true
} else { } else {
const styledTypeScript = chalk.hex('#007acc')('TypeScript') const styledTypeScript = chalk.hex('#0645ad')('TypeScript')
const { typescript } = await prompts( const { typescript } = await prompts(
{ {
type: 'toggle', type: 'toggle',
...@@ -275,7 +280,7 @@ async function run(): Promise<void> { ...@@ -275,7 +280,7 @@ async function run(): Promise<void> {
if (ciInfo.isCI) { if (ciInfo.isCI) {
program.eslint = true program.eslint = true
} else { } else {
const styledEslint = chalk.hex('#007acc')('ESLint') const styledEslint = chalk.hex('#4b32c3')('ESLint')
const { eslint } = await prompts({ const { eslint } = await prompts({
onState: onPromptState, onState: onPromptState,
type: 'toggle', type: 'toggle',
...@@ -290,6 +295,28 @@ async function run(): Promise<void> { ...@@ -290,6 +295,28 @@ async function run(): Promise<void> {
} }
} }
if (
!process.argv.includes('--tailwind') &&
!process.argv.includes('--no-tailwind')
) {
if (ciInfo.isCI) {
program.tailwind = false
} else {
const tw = chalk.hex('#38BDF8')('Tailwind CSS')
const { tailwind } = await prompts({
onState: onPromptState,
type: 'toggle',
name: 'tailwind',
message: `Would you like to use ${tw} with this project?`,
initial: getPrefOrDefault('tailwind'),
active: 'Yes',
inactive: 'No',
})
program.tailwind = Boolean(tailwind)
preferences.tailwind = Boolean(tailwind)
}
}
if ( if (
!process.argv.includes('--src-dir') && !process.argv.includes('--src-dir') &&
!process.argv.includes('--no-src-dir') !process.argv.includes('--no-src-dir')
...@@ -367,6 +394,7 @@ async function run(): Promise<void> { ...@@ -367,6 +394,7 @@ async function run(): Promise<void> {
example: example && example !== 'default' ? example : undefined, example: example && example !== 'default' ? example : undefined,
examplePath: program.examplePath, examplePath: program.examplePath,
typescript: program.typescript, typescript: program.typescript,
tailwind: program.tailwind,
eslint: program.eslint, eslint: program.eslint,
experimentalApp: program.experimentalApp, experimentalApp: program.experimentalApp,
srcDir: program.srcDir, srcDir: program.srcDir,
...@@ -395,6 +423,7 @@ async function run(): Promise<void> { ...@@ -395,6 +423,7 @@ async function run(): Promise<void> {
packageManager, packageManager,
typescript: program.typescript, typescript: program.typescript,
eslint: program.eslint, eslint: program.eslint,
tailwind: program.tailwind,
experimentalApp: program.experimentalApp, experimentalApp: program.experimentalApp,
srcDir: program.srcDir, srcDir: program.srcDir,
importAlias: program.importAlias, importAlias: program.importAlias,
......
...@@ -26,7 +26,8 @@ ...@@ -26,7 +26,8 @@
"release": "ncc build ./index.ts -o ./dist/ --minify --no-cache --no-source-map-register", "release": "ncc build ./index.ts -o ./dist/ --minify --no-cache --no-source-map-register",
"prepublishOnly": "cd ../../ && turbo run build", "prepublishOnly": "cd ../../ && turbo run build",
"build": "pnpm release", "build": "pnpm release",
"test-pack": "cd ../../ && pnpm test-pack create-next-app" "test-pack": "cd ../../ && pnpm test-pack create-next-app",
"lint-fix": "pnpm prettier -w --plugin prettier-plugin-tailwindcss 'templates/*-tw/{ts,js}/{app,pages}/**/*.{js,ts,tsx}'"
}, },
"devDependencies": { "devDependencies": {
"@types/async-retry": "1.4.2", "@types/async-retry": "1.4.2",
...@@ -48,6 +49,7 @@ ...@@ -48,6 +49,7 @@
"cross-spawn": "6.0.5", "cross-spawn": "6.0.5",
"glob": "8.0.3", "glob": "8.0.3",
"got": "10.7.0", "got": "10.7.0",
"prettier-plugin-tailwindcss": "0.2.4",
"prompts": "2.1.0", "prompts": "2.1.0",
"tar": "4.4.10", "tar": "4.4.10",
"update-check": "1.5.4", "update-check": "1.5.4",
......
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
## Getting Started
First, run the development server:
```bash
npm run dev
# or
yarn dev
# or
pnpm dev
```
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
You can start editing the page by modifying `app/page.js`. The page auto-updates as you edit the file.
[http://localhost:3000/api/hello](http://localhost:3000/api/hello) is an endpoint that uses [Route Handlers](https://beta.nextjs.org/docs/routing/route-handlers). This endpoint can be edited in `app/api/hello/route.js`.
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
## Learn More
To learn more about Next.js, take a look at the following resources:
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
## Deploy on Vercel
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
export async function GET(request: Request) {
return new Response('Hello, Next.js!')
}
@tailwind base;
@tailwind components;
@tailwind utilities;
:root {
--foreground-rgb: 0, 0, 0;
--background-start-rgb: 214, 219, 220;
--background-end-rgb: 255, 255, 255;
}
@media (prefers-color-scheme: dark) {
:root {
--foreground-rgb: 255, 255, 255;
--background-start-rgb: 0, 0, 0;
--background-end-rgb: 0, 0, 0;
}
}
body {
color: rgb(var(--foreground-rgb));
background: linear-gradient(
to bottom,
transparent,
rgb(var(--background-end-rgb))
)
rgb(var(--background-start-rgb));
}
import './globals.css'
export const metadata = {
title: 'Create Next App',
description: 'Generated by create next app',
}
export default function RootLayout({ children }) {
return (
<html lang="en">
<body>{children}</body>
</html>
)
}
import Image from 'next/image'
import { Inter } from 'next/font/google'
const inter = Inter({ subsets: ['latin'] })
export default function Home() {
return (
<main className="flex min-h-screen flex-col items-center justify-between p-24">
<div className="z-10 w-full max-w-5xl items-center justify-between font-mono text-sm lg:flex">
<p className="fixed left-0 top-0 flex w-full justify-center border-b border-gray-300 bg-gradient-to-b from-zinc-200 pb-6 pt-8 backdrop-blur-2xl dark:border-neutral-800 dark:bg-zinc-800 dark:bg-opacity-30 dark:from-inherit lg:static lg:w-auto lg:rounded-xl lg:border lg:bg-gray-200 lg:p-4 lg:dark:bg-zinc-800 lg:dark:bg-opacity-30">
Get started by editing&nbsp;
<code className="font-mono font-bold">app/page.tsx</code>
</p>
<div className="fixed bottom-0 left-0 flex h-48 w-full items-end justify-center bg-gradient-to-t from-white via-white dark:from-black dark:via-black lg:static lg:h-auto lg:w-auto lg:bg-none">
<a
className="pointer-events-none flex place-items-center gap-2 p-8 lg:pointer-events-auto lg:p-0"
href="https://vercel.com?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
By{' '}
<Image
src="/vercel.svg"
alt="Vercel Logo"
className="dark:invert"
width={100}
height={24}
priority
/>
</a>
</div>
</div>
<div className="before:bg-gradient-radial after:bg-gradient-conic relative flex place-items-center before:absolute before:h-[300px] before:w-[480px] before:-translate-x-1/2 before:rounded-full before:from-white before:to-transparent before:blur-2xl before:content-[''] after:absolute after:-z-20 after:h-[180px] after:w-[240px] after:translate-x-1/2 after:from-sky-200 after:via-blue-200 after:blur-2xl after:content-[''] before:dark:bg-gradient-to-br before:dark:from-transparent before:dark:to-blue-700 before:dark:opacity-10 after:dark:translate-x-2/3 after:dark:from-sky-900 after:dark:via-[#0141ff] after:dark:opacity-40 before:lg:h-[360px]">
<Image
className="relative dark:drop-shadow-[0_0_0.3rem_#ffffff70] dark:invert"
src="/next.svg"
alt="Next.js Logo"
width={180}
height={37}
priority
/>
<div className="before:bg-gradient-conic relative ml-4 flex h-20 w-20 items-center justify-center overflow-hidden rounded-xl shadow-lg before:absolute before:-z-10 before:h-[200%] before:w-[200%] before:animate-[spin_6s_linear_reverse_infinite] before:from-transparent before:via-black before:content-[''] after:absolute after:inset-[1px] after:-z-10 after:rounded-xl after:bg-gradient-to-br after:from-slate-50 after:to-slate-200 after:content-[''] motion-reduce:animate-none before:dark:via-white before:dark:to-transparent before:dark:opacity-50 after:dark:from-black after:dark:to-black">
<Image
className="dark:drop-shadow-[0_0_0.3rem_#ffffff70] dark:invert"
src="/thirteen.svg"
alt="13"
width={40}
height={31}
priority
/>
</div>
</div>
<div className="mb-32 grid text-center lg:mb-0 lg:grid-cols-3 lg:text-left">
<a
href="https://beta.nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800 hover:dark:bg-opacity-30"
target="_blank"
rel="noopener noreferrer"
>
<h2 className={`${inter.className} mb-3 text-2xl font-semibold`}>
Docs{' '}
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
-&gt;
</span>
</h2>
<p
className={`${inter.className} m-0 max-w-[34ch] text-sm opacity-50`}
>
Find in-depth information about Next.js features and API.
</p>
</a>
<a
href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800 hover:dark:bg-opacity-30"
target="_blank"
rel="noopener noreferrer"
>
<h2 className={`${inter.className} mb-3 text-2xl font-semibold`}>
Templates{' '}
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
-&gt;
</span>
</h2>
<p
className={`${inter.className} m-0 max-w-[34ch] text-sm opacity-50`}
>
Explore the Next.js 13 playground.
</p>
</a>
<a
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800 hover:dark:bg-opacity-30"
target="_blank"
rel="noopener noreferrer"
>
<h2 className={`${inter.className} mb-3 text-2xl font-semibold`}>
Deploy{' '}
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
-&gt;
</span>
</h2>
<p
className={`${inter.className} m-0 max-w-[34ch] text-sm opacity-50`}
>
Instantly deploy your Next.js site to a shareable URL with Vercel.
</p>
</a>
</div>
</main>
)
}
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# next.js
/.next/
/out/
# production
/build
# misc
.DS_Store
*.pem
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*
# local env files
.env*.local
# vercel
.vercel
{
"compilerOptions": {
"paths": {
"@/*": ["./*"]
}
}
}
/** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
appDir: true,
},
}
module.exports = nextConfig
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 394 80"><path fill="#000" d="M262 0h68.5v12.7h-27.2v66.6h-13.6V12.7H262V0ZM149 0v12.7H94v20.4h44.3v12.6H94v21h55v12.6H80.5V0h68.7zm34.3 0h-17.8l63.8 79.4h17.9l-32-39.7 32-39.6h-17.9l-23 28.6-23-28.6zm18.3 56.7-9-11-27.1 33.7h17.8l18.3-22.7z"/><path fill="#000" d="M81 79.3 17 0H0v79.3h13.6V17l50.2 62.3H81Zm252.6-.4c-1 0-1.8-.4-2.5-1s-1.1-1.6-1.1-2.6.3-1.8 1-2.5 1.6-1 2.6-1 1.8.3 2.5 1a3.4 3.4 0 0 1 .6 4.3 3.7 3.7 0 0 1-3 1.8zm23.2-33.5h6v23.3c0 2.1-.4 4-1.3 5.5a9.1 9.1 0 0 1-3.8 3.5c-1.6.8-3.5 1.3-5.7 1.3-2 0-3.7-.4-5.3-1s-2.8-1.8-3.7-3.2c-.9-1.3-1.4-3-1.4-5h6c.1.8.3 1.6.7 2.2s1 1.2 1.6 1.5c.7.4 1.5.5 2.4.5 1 0 1.8-.2 2.4-.6a4 4 0 0 0 1.6-1.8c.3-.8.5-1.8.5-3V45.5zm30.9 9.1a4.4 4.4 0 0 0-2-3.3 7.5 7.5 0 0 0-4.3-1.1c-1.3 0-2.4.2-3.3.5-.9.4-1.6 1-2 1.6a3.5 3.5 0 0 0-.3 4c.3.5.7.9 1.3 1.2l1.8 1 2 .5 3.2.8c1.3.3 2.5.7 3.7 1.2a13 13 0 0 1 3.2 1.8 8.1 8.1 0 0 1 3 6.5c0 2-.5 3.7-1.5 5.1a10 10 0 0 1-4.4 3.5c-1.8.8-4.1 1.2-6.8 1.2-2.6 0-4.9-.4-6.8-1.2-2-.8-3.4-2-4.5-3.5a10 10 0 0 1-1.7-5.6h6a5 5 0 0 0 3.5 4.6c1 .4 2.2.6 3.4.6 1.3 0 2.5-.2 3.5-.6 1-.4 1.8-1 2.4-1.7a4 4 0 0 0 .8-2.4c0-.9-.2-1.6-.7-2.2a11 11 0 0 0-2.1-1.4l-3.2-1-3.8-1c-2.8-.7-5-1.7-6.6-3.2a7.2 7.2 0 0 1-2.4-5.7 8 8 0 0 1 1.7-5 10 10 0 0 1 4.3-3.5c2-.8 4-1.2 6.4-1.2 2.3 0 4.4.4 6.2 1.2 1.8.8 3.2 2 4.3 3.4 1 1.4 1.5 3 1.5 5h-5.8z"/></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" width="40" height="31" fill="none"><g opacity=".9"><path fill="url(#a)" d="M13 .4v29.3H7V6.3h-.2L0 10.5V5L7.2.4H13Z"/><path fill="url(#b)" d="M28.8 30.1c-2.2 0-4-.3-5.7-1-1.7-.8-3-1.8-4-3.1a7.7 7.7 0 0 1-1.4-4.6h6.2c0 .8.3 1.4.7 2 .4.5 1 .9 1.7 1.2.7.3 1.6.4 2.5.4 1 0 1.7-.2 2.5-.5.7-.3 1.3-.8 1.7-1.4.4-.6.6-1.2.6-2s-.2-1.5-.7-2.1c-.4-.6-1-1-1.8-1.4-.8-.4-1.8-.5-2.9-.5h-2.7v-4.6h2.7a6 6 0 0 0 2.5-.5 4 4 0 0 0 1.7-1.3c.4-.6.6-1.3.6-2a3.5 3.5 0 0 0-2-3.3 5.6 5.6 0 0 0-4.5 0 4 4 0 0 0-1.7 1.2c-.4.6-.6 1.2-.6 2h-6c0-1.7.6-3.2 1.5-4.5 1-1.3 2.2-2.3 3.8-3C25 .4 26.8 0 28.8 0s3.8.4 5.3 1.1c1.5.7 2.7 1.7 3.6 3a7.2 7.2 0 0 1 1.2 4.2c0 1.6-.5 3-1.5 4a7 7 0 0 1-4 2.2v.2c2.2.3 3.8 1 5 2.2a6.4 6.4 0 0 1 1.6 4.6c0 1.7-.5 3.1-1.4 4.4a9.7 9.7 0 0 1-4 3.1c-1.7.8-3.7 1.1-5.8 1.1Z"/></g><defs><linearGradient id="a" x1="20" x2="20" y1="0" y2="30.1" gradientUnits="userSpaceOnUse"><stop/><stop offset="1" stop-color="#3D3D3D"/></linearGradient><linearGradient id="b" x1="20" x2="20" y1="0" y2="30.1" gradientUnits="userSpaceOnUse"><stop/><stop offset="1" stop-color="#3D3D3D"/></linearGradient></defs></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 283 64"><path fill="black" d="M141 16c-11 0-19 7-19 18s9 18 20 18c7 0 13-3 16-7l-7-5c-2 3-6 4-9 4-5 0-9-3-10-7h28v-3c0-11-8-18-19-18zm-9 15c1-4 4-7 9-7s8 3 9 7h-18zm117-15c-11 0-19 7-19 18s9 18 20 18c6 0 12-3 16-7l-8-5c-2 3-5 4-8 4-5 0-9-3-11-7h28l1-3c0-11-8-18-19-18zm-10 15c2-4 5-7 10-7s8 3 9 7h-19zm-39 3c0 6 4 10 10 10 4 0 7-2 9-5l8 5c-3 5-9 8-17 8-11 0-19-7-19-18s8-18 19-18c8 0 14 3 17 8l-8 5c-2-3-5-5-9-5-6 0-10 4-10 10zm83-29v46h-9V5h9zM37 0l37 64H0L37 0zm92 5-27 48L74 5h10l18 30 17-30h10zm59 12v10l-3-1c-6 0-10 4-10 10v15h-9V17h9v9c0-5 6-9 13-9z"/></svg>
\ No newline at end of file
...@@ -6,7 +6,13 @@ module.exports = { ...@@ -6,7 +6,13 @@ module.exports = {
'./app/**/*.{js,ts,jsx,tsx}', './app/**/*.{js,ts,jsx,tsx}',
], ],
theme: { theme: {
extend: {}, extend: {
backgroundImage: {
'gradient-radial': 'radial-gradient(var(--tw-gradient-stops))',
'gradient-conic':
'conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))',
},
},
}, },
plugins: [], plugins: [],
} }
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
## Getting Started
First, run the development server:
```bash
npm run dev
# or
yarn dev
# or
pnpm dev
```
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
[http://localhost:3000/api/hello](http://localhost:3000/api/hello) is an endpoint that uses [Route Handlers](https://beta.nextjs.org/docs/routing/route-handlers). This endpoint can be edited in `app/api/hello/route.ts`.
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
## Learn More
To learn more about Next.js, take a look at the following resources:
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
## Deploy on Vercel
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
export async function GET(request: Request) {
return new Response('Hello, Next.js!')
}
@tailwind base;
@tailwind components;
@tailwind utilities;
:root {
--foreground-rgb: 0, 0, 0;
--background-start-rgb: 214, 219, 220;
--background-end-rgb: 255, 255, 255;
}
@media (prefers-color-scheme: dark) {
:root {
--foreground-rgb: 255, 255, 255;
--background-start-rgb: 0, 0, 0;
--background-end-rgb: 0, 0, 0;
}
}
body {
color: rgb(var(--foreground-rgb));
background: linear-gradient(
to bottom,
transparent,
rgb(var(--background-end-rgb))
)
rgb(var(--background-start-rgb));
}
import './globals.css'
export const metadata = {
title: 'Create Next App',
description: 'Generated by create next app',
}
export default function RootLayout({
children,
}: {
children: React.ReactNode
}) {
return (
<html lang="en">
<body>{children}</body>
</html>
)
}
import Image from 'next/image'
import { Inter } from 'next/font/google'
const inter = Inter({ subsets: ['latin'] })
export default function Home() {
return (
<main className="flex min-h-screen flex-col items-center justify-between p-24">
<div className="z-10 w-full max-w-5xl items-center justify-between font-mono text-sm lg:flex">
<p className="fixed left-0 top-0 flex w-full justify-center border-b border-gray-300 bg-gradient-to-b from-zinc-200 pb-6 pt-8 backdrop-blur-2xl dark:border-neutral-800 dark:bg-zinc-800 dark:bg-opacity-30 dark:from-inherit lg:static lg:w-auto lg:rounded-xl lg:border lg:bg-gray-200 lg:p-4 lg:dark:bg-zinc-800 lg:dark:bg-opacity-30">
Get started by editing&nbsp;
<code className="font-mono font-bold">app/page.tsx</code>
</p>
<div className="fixed bottom-0 left-0 flex h-48 w-full items-end justify-center bg-gradient-to-t from-white via-white dark:from-black dark:via-black lg:static lg:h-auto lg:w-auto lg:bg-none">
<a
className="pointer-events-none flex place-items-center gap-2 p-8 lg:pointer-events-auto lg:p-0"
href="https://vercel.com?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
By{' '}
<Image
src="/vercel.svg"
alt="Vercel Logo"
className="dark:invert"
width={100}
height={24}
priority
/>
</a>
</div>
</div>
<div className="before:bg-gradient-radial after:bg-gradient-conic relative flex place-items-center before:absolute before:h-[300px] before:w-[480px] before:-translate-x-1/2 before:rounded-full before:from-white before:to-transparent before:blur-2xl before:content-[''] after:absolute after:-z-20 after:h-[180px] after:w-[240px] after:translate-x-1/2 after:from-sky-200 after:via-blue-200 after:blur-2xl after:content-[''] before:dark:bg-gradient-to-br before:dark:from-transparent before:dark:to-blue-700 before:dark:opacity-10 after:dark:translate-x-2/3 after:dark:from-sky-900 after:dark:via-[#0141ff] after:dark:opacity-40 before:lg:h-[360px]">
<Image
className="relative dark:drop-shadow-[0_0_0.3rem_#ffffff70] dark:invert"
src="/next.svg"
alt="Next.js Logo"
width={180}
height={37}
priority
/>
<div className="before:bg-gradient-conic relative ml-4 flex h-20 w-20 items-center justify-center overflow-hidden rounded-xl shadow-lg before:absolute before:-z-10 before:h-[200%] before:w-[200%] before:animate-[spin_6s_linear_reverse_infinite] before:from-transparent before:via-black before:content-[''] after:absolute after:inset-[1px] after:-z-10 after:rounded-xl after:bg-gradient-to-br after:from-slate-50 after:to-slate-200 after:content-[''] motion-reduce:animate-none before:dark:via-white before:dark:to-transparent before:dark:opacity-50 after:dark:from-black after:dark:to-black">
<Image
className="dark:drop-shadow-[0_0_0.3rem_#ffffff70] dark:invert"
src="/thirteen.svg"
alt="13"
width={40}
height={31}
priority
/>
</div>
</div>
<div className="mb-32 grid text-center lg:mb-0 lg:grid-cols-3 lg:text-left">
<a
href="https://beta.nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800 hover:dark:bg-opacity-30"
target="_blank"
rel="noopener noreferrer"
>
<h2 className={`${inter.className} mb-3 text-2xl font-semibold`}>
Docs{' '}
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
-&gt;
</span>
</h2>
<p
className={`${inter.className} m-0 max-w-[34ch] text-sm opacity-50`}
>
Find in-depth information about Next.js features and API.
</p>
</a>
<a
href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800 hover:dark:bg-opacity-30"
target="_blank"
rel="noopener noreferrer"
>
<h2 className={`${inter.className} mb-3 text-2xl font-semibold`}>
Templates{' '}
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
-&gt;
</span>
</h2>
<p
className={`${inter.className} m-0 max-w-[34ch] text-sm opacity-50`}
>
Explore the Next.js 13 playground.
</p>
</a>
<a
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800 hover:dark:bg-opacity-30"
target="_blank"
rel="noopener noreferrer"
>
<h2 className={`${inter.className} mb-3 text-2xl font-semibold`}>
Deploy{' '}
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
-&gt;
</span>
</h2>
<p
className={`${inter.className} m-0 max-w-[34ch] text-sm opacity-50`}
>
Instantly deploy your Next.js site to a shareable URL with Vercel.
</p>
</a>
</div>
</main>
)
}
/// <reference types="next" />
/// <reference types="next/image-types/global" />
// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
/** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
appDir: true,
},
}
module.exports = nextConfig
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 394 80"><path fill="#000" d="M262 0h68.5v12.7h-27.2v66.6h-13.6V12.7H262V0ZM149 0v12.7H94v20.4h44.3v12.6H94v21h55v12.6H80.5V0h68.7zm34.3 0h-17.8l63.8 79.4h17.9l-32-39.7 32-39.6h-17.9l-23 28.6-23-28.6zm18.3 56.7-9-11-27.1 33.7h17.8l18.3-22.7z"/><path fill="#000" d="M81 79.3 17 0H0v79.3h13.6V17l50.2 62.3H81Zm252.6-.4c-1 0-1.8-.4-2.5-1s-1.1-1.6-1.1-2.6.3-1.8 1-2.5 1.6-1 2.6-1 1.8.3 2.5 1a3.4 3.4 0 0 1 .6 4.3 3.7 3.7 0 0 1-3 1.8zm23.2-33.5h6v23.3c0 2.1-.4 4-1.3 5.5a9.1 9.1 0 0 1-3.8 3.5c-1.6.8-3.5 1.3-5.7 1.3-2 0-3.7-.4-5.3-1s-2.8-1.8-3.7-3.2c-.9-1.3-1.4-3-1.4-5h6c.1.8.3 1.6.7 2.2s1 1.2 1.6 1.5c.7.4 1.5.5 2.4.5 1 0 1.8-.2 2.4-.6a4 4 0 0 0 1.6-1.8c.3-.8.5-1.8.5-3V45.5zm30.9 9.1a4.4 4.4 0 0 0-2-3.3 7.5 7.5 0 0 0-4.3-1.1c-1.3 0-2.4.2-3.3.5-.9.4-1.6 1-2 1.6a3.5 3.5 0 0 0-.3 4c.3.5.7.9 1.3 1.2l1.8 1 2 .5 3.2.8c1.3.3 2.5.7 3.7 1.2a13 13 0 0 1 3.2 1.8 8.1 8.1 0 0 1 3 6.5c0 2-.5 3.7-1.5 5.1a10 10 0 0 1-4.4 3.5c-1.8.8-4.1 1.2-6.8 1.2-2.6 0-4.9-.4-6.8-1.2-2-.8-3.4-2-4.5-3.5a10 10 0 0 1-1.7-5.6h6a5 5 0 0 0 3.5 4.6c1 .4 2.2.6 3.4.6 1.3 0 2.5-.2 3.5-.6 1-.4 1.8-1 2.4-1.7a4 4 0 0 0 .8-2.4c0-.9-.2-1.6-.7-2.2a11 11 0 0 0-2.1-1.4l-3.2-1-3.8-1c-2.8-.7-5-1.7-6.6-3.2a7.2 7.2 0 0 1-2.4-5.7 8 8 0 0 1 1.7-5 10 10 0 0 1 4.3-3.5c2-.8 4-1.2 6.4-1.2 2.3 0 4.4.4 6.2 1.2 1.8.8 3.2 2 4.3 3.4 1 1.4 1.5 3 1.5 5h-5.8z"/></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" width="40" height="31" fill="none"><g opacity=".9"><path fill="url(#a)" d="M13 .4v29.3H7V6.3h-.2L0 10.5V5L7.2.4H13Z"/><path fill="url(#b)" d="M28.8 30.1c-2.2 0-4-.3-5.7-1-1.7-.8-3-1.8-4-3.1a7.7 7.7 0 0 1-1.4-4.6h6.2c0 .8.3 1.4.7 2 .4.5 1 .9 1.7 1.2.7.3 1.6.4 2.5.4 1 0 1.7-.2 2.5-.5.7-.3 1.3-.8 1.7-1.4.4-.6.6-1.2.6-2s-.2-1.5-.7-2.1c-.4-.6-1-1-1.8-1.4-.8-.4-1.8-.5-2.9-.5h-2.7v-4.6h2.7a6 6 0 0 0 2.5-.5 4 4 0 0 0 1.7-1.3c.4-.6.6-1.3.6-2a3.5 3.5 0 0 0-2-3.3 5.6 5.6 0 0 0-4.5 0 4 4 0 0 0-1.7 1.2c-.4.6-.6 1.2-.6 2h-6c0-1.7.6-3.2 1.5-4.5 1-1.3 2.2-2.3 3.8-3C25 .4 26.8 0 28.8 0s3.8.4 5.3 1.1c1.5.7 2.7 1.7 3.6 3a7.2 7.2 0 0 1 1.2 4.2c0 1.6-.5 3-1.5 4a7 7 0 0 1-4 2.2v.2c2.2.3 3.8 1 5 2.2a6.4 6.4 0 0 1 1.6 4.6c0 1.7-.5 3.1-1.4 4.4a9.7 9.7 0 0 1-4 3.1c-1.7.8-3.7 1.1-5.8 1.1Z"/></g><defs><linearGradient id="a" x1="20" x2="20" y1="0" y2="30.1" gradientUnits="userSpaceOnUse"><stop/><stop offset="1" stop-color="#3D3D3D"/></linearGradient><linearGradient id="b" x1="20" x2="20" y1="0" y2="30.1" gradientUnits="userSpaceOnUse"><stop/><stop offset="1" stop-color="#3D3D3D"/></linearGradient></defs></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 283 64"><path fill="black" d="M141 16c-11 0-19 7-19 18s9 18 20 18c7 0 13-3 16-7l-7-5c-2 3-6 4-9 4-5 0-9-3-10-7h28v-3c0-11-8-18-19-18zm-9 15c1-4 4-7 9-7s8 3 9 7h-18zm117-15c-11 0-19 7-19 18s9 18 20 18c6 0 12-3 16-7l-8-5c-2 3-5 4-8 4-5 0-9-3-11-7h28l1-3c0-11-8-18-19-18zm-10 15c2-4 5-7 10-7s8 3 9 7h-19zm-39 3c0 6 4 10 10 10 4 0 7-2 9-5l8 5c-3 5-9 8-17 8-11 0-19-7-19-18s8-18 19-18c8 0 14 3 17 8l-8 5c-2-3-5-5-9-5-6 0-10 4-10 10zm83-29v46h-9V5h9zM37 0l37 64H0L37 0zm92 5-27 48L74 5h10l18 30 17-30h10zm59 12v10l-3-1c-6 0-10 4-10 10v15h-9V17h9v9c0-5 6-9 13-9z"/></svg>
\ No newline at end of file
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
'./pages/**/*.{js,ts,jsx,tsx}',
'./components/**/*.{js,ts,jsx,tsx}',
'./app/**/*.{js,ts,jsx,tsx}',
],
theme: {
extend: {
backgroundImage: {
'gradient-radial': 'radial-gradient(var(--tw-gradient-stops))',
'gradient-conic':
'conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))',
},
},
},
plugins: [],
}
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"plugins": [
{
"name": "next"
}
],
"paths": {
"@/*": ["./*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
## Getting Started
First, run the development server:
```bash
npm run dev
# or
yarn dev
# or
pnpm dev
```
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file.
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`.
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
## Learn More
To learn more about Next.js, take a look at the following resources:
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
## Deploy on Vercel
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# next.js
/.next/
/out/
# production
/build
# misc
.DS_Store
*.pem
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*
# local env files
.env*.local
# vercel
.vercel
{
"compilerOptions": {
"paths": {
"@/*": ["./*"]
}
}
}
/** @type {import('next').NextConfig} */ /** @type {import('next').NextConfig} */
module.exports = { const nextConfig = {
reactStrictMode: true, reactStrictMode: true,
} }
module.exports = nextConfig
import '../styles/global.scss' import '@/styles/globals.css'
export default function MyApp({ Component, pageProps }) { export default function App({ Component, pageProps }) {
return <Component {...pageProps} /> return <Component {...pageProps} />
} }
import { Html, Head, Main, NextScript } from 'next/document'
export default function Document() {
return (
<Html lang="en">
<Head />
<body>
<Main />
<NextScript />
</body>
</Html>
)
}
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
export default function handler(req, res) {
res.status(200).json({ name: 'John Doe' })
}
import Image from 'next/image'
import { Inter } from 'next/font/google'
const inter = Inter({ subsets: ['latin'] })
export default function Home() {
return (
<main className="flex min-h-screen flex-col items-center justify-between p-24">
<div className="z-10 w-full max-w-5xl items-center justify-between font-mono text-sm lg:flex">
<p className="fixed left-0 top-0 flex w-full justify-center border-b border-gray-300 bg-gradient-to-b from-zinc-200 pb-6 pt-8 backdrop-blur-2xl dark:border-neutral-800 dark:bg-zinc-800 dark:bg-opacity-30 dark:from-inherit lg:static lg:w-auto lg:rounded-xl lg:border lg:bg-gray-200 lg:p-4 lg:dark:bg-zinc-800 lg:dark:bg-opacity-30">
Get started by editing&nbsp;
<code className="font-mono font-bold">app/page.tsx</code>
</p>
<div className="fixed bottom-0 left-0 flex h-48 w-full items-end justify-center bg-gradient-to-t from-white via-white dark:from-black dark:via-black lg:static lg:h-auto lg:w-auto lg:bg-none">
<a
className="pointer-events-none flex place-items-center gap-2 p-8 lg:pointer-events-auto lg:p-0"
href="https://vercel.com?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
By{' '}
<Image
src="/vercel.svg"
alt="Vercel Logo"
className="dark:invert"
width={100}
height={24}
priority
/>
</a>
</div>
</div>
<div className="before:bg-gradient-radial after:bg-gradient-conic relative flex place-items-center before:absolute before:h-[300px] before:w-[480px] before:-translate-x-1/2 before:rounded-full before:from-white before:to-transparent before:blur-2xl before:content-[''] after:absolute after:-z-20 after:h-[180px] after:w-[240px] after:translate-x-1/2 after:from-sky-200 after:via-blue-200 after:blur-2xl after:content-[''] before:dark:bg-gradient-to-br before:dark:from-transparent before:dark:to-blue-700 before:dark:opacity-10 after:dark:translate-x-2/3 after:dark:from-sky-900 after:dark:via-[#0141ff] after:dark:opacity-40 before:lg:h-[360px]">
<Image
className="relative dark:drop-shadow-[0_0_0.3rem_#ffffff70] dark:invert"
src="/next.svg"
alt="Next.js Logo"
width={180}
height={37}
priority
/>
<div className="before:bg-gradient-conic relative ml-4 flex h-20 w-20 items-center justify-center overflow-hidden rounded-xl shadow-lg before:absolute before:-z-10 before:h-[200%] before:w-[200%] before:animate-[spin_6s_linear_reverse_infinite] before:from-transparent before:via-black before:content-[''] after:absolute after:inset-[1px] after:-z-10 after:rounded-xl after:bg-gradient-to-br after:from-slate-50 after:to-slate-200 after:content-[''] motion-reduce:animate-none before:dark:via-white before:dark:to-transparent before:dark:opacity-50 after:dark:from-black after:dark:to-black">
<Image
className="dark:drop-shadow-[0_0_0.3rem_#ffffff70] dark:invert"
src="/thirteen.svg"
alt="13"
width={40}
height={31}
priority
/>
</div>
</div>
<div className="mb-32 grid text-center lg:mb-0 lg:grid-cols-3 lg:text-left">
<a
href="https://beta.nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800 hover:dark:bg-opacity-30"
target="_blank"
rel="noopener noreferrer"
>
<h2 className={`${inter.className} mb-3 text-2xl font-semibold`}>
Docs{' '}
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
-&gt;
</span>
</h2>
<p
className={`${inter.className} m-0 max-w-[34ch] text-sm opacity-50`}
>
Find in-depth information about Next.js features and API.
</p>
</a>
<a
href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800 hover:dark:bg-opacity-30"
target="_blank"
rel="noopener noreferrer"
>
<h2 className={`${inter.className} mb-3 text-2xl font-semibold`}>
Templates{' '}
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
-&gt;
</span>
</h2>
<p
className={`${inter.className} m-0 max-w-[34ch] text-sm opacity-50`}
>
Explore the Next.js 13 playground.
</p>
</a>
<a
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800 hover:dark:bg-opacity-30"
target="_blank"
rel="noopener noreferrer"
>
<h2 className={`${inter.className} mb-3 text-2xl font-semibold`}>
Deploy{' '}
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
-&gt;
</span>
</h2>
<p
className={`${inter.className} m-0 max-w-[34ch] text-sm opacity-50`}
>
Instantly deploy your Next.js site to a shareable URL with Vercel.
</p>
</a>
</div>
</main>
)
}
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 394 80"><path fill="#000" d="M262 0h68.5v12.7h-27.2v66.6h-13.6V12.7H262V0ZM149 0v12.7H94v20.4h44.3v12.6H94v21h55v12.6H80.5V0h68.7zm34.3 0h-17.8l63.8 79.4h17.9l-32-39.7 32-39.6h-17.9l-23 28.6-23-28.6zm18.3 56.7-9-11-27.1 33.7h17.8l18.3-22.7z"/><path fill="#000" d="M81 79.3 17 0H0v79.3h13.6V17l50.2 62.3H81Zm252.6-.4c-1 0-1.8-.4-2.5-1s-1.1-1.6-1.1-2.6.3-1.8 1-2.5 1.6-1 2.6-1 1.8.3 2.5 1a3.4 3.4 0 0 1 .6 4.3 3.7 3.7 0 0 1-3 1.8zm23.2-33.5h6v23.3c0 2.1-.4 4-1.3 5.5a9.1 9.1 0 0 1-3.8 3.5c-1.6.8-3.5 1.3-5.7 1.3-2 0-3.7-.4-5.3-1s-2.8-1.8-3.7-3.2c-.9-1.3-1.4-3-1.4-5h6c.1.8.3 1.6.7 2.2s1 1.2 1.6 1.5c.7.4 1.5.5 2.4.5 1 0 1.8-.2 2.4-.6a4 4 0 0 0 1.6-1.8c.3-.8.5-1.8.5-3V45.5zm30.9 9.1a4.4 4.4 0 0 0-2-3.3 7.5 7.5 0 0 0-4.3-1.1c-1.3 0-2.4.2-3.3.5-.9.4-1.6 1-2 1.6a3.5 3.5 0 0 0-.3 4c.3.5.7.9 1.3 1.2l1.8 1 2 .5 3.2.8c1.3.3 2.5.7 3.7 1.2a13 13 0 0 1 3.2 1.8 8.1 8.1 0 0 1 3 6.5c0 2-.5 3.7-1.5 5.1a10 10 0 0 1-4.4 3.5c-1.8.8-4.1 1.2-6.8 1.2-2.6 0-4.9-.4-6.8-1.2-2-.8-3.4-2-4.5-3.5a10 10 0 0 1-1.7-5.6h6a5 5 0 0 0 3.5 4.6c1 .4 2.2.6 3.4.6 1.3 0 2.5-.2 3.5-.6 1-.4 1.8-1 2.4-1.7a4 4 0 0 0 .8-2.4c0-.9-.2-1.6-.7-2.2a11 11 0 0 0-2.1-1.4l-3.2-1-3.8-1c-2.8-.7-5-1.7-6.6-3.2a7.2 7.2 0 0 1-2.4-5.7 8 8 0 0 1 1.7-5 10 10 0 0 1 4.3-3.5c2-.8 4-1.2 6.4-1.2 2.3 0 4.4.4 6.2 1.2 1.8.8 3.2 2 4.3 3.4 1 1.4 1.5 3 1.5 5h-5.8z"/></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" width="40" height="31" fill="none"><g opacity=".9"><path fill="url(#a)" d="M13 .4v29.3H7V6.3h-.2L0 10.5V5L7.2.4H13Z"/><path fill="url(#b)" d="M28.8 30.1c-2.2 0-4-.3-5.7-1-1.7-.8-3-1.8-4-3.1a7.7 7.7 0 0 1-1.4-4.6h6.2c0 .8.3 1.4.7 2 .4.5 1 .9 1.7 1.2.7.3 1.6.4 2.5.4 1 0 1.7-.2 2.5-.5.7-.3 1.3-.8 1.7-1.4.4-.6.6-1.2.6-2s-.2-1.5-.7-2.1c-.4-.6-1-1-1.8-1.4-.8-.4-1.8-.5-2.9-.5h-2.7v-4.6h2.7a6 6 0 0 0 2.5-.5 4 4 0 0 0 1.7-1.3c.4-.6.6-1.3.6-2a3.5 3.5 0 0 0-2-3.3 5.6 5.6 0 0 0-4.5 0 4 4 0 0 0-1.7 1.2c-.4.6-.6 1.2-.6 2h-6c0-1.7.6-3.2 1.5-4.5 1-1.3 2.2-2.3 3.8-3C25 .4 26.8 0 28.8 0s3.8.4 5.3 1.1c1.5.7 2.7 1.7 3.6 3a7.2 7.2 0 0 1 1.2 4.2c0 1.6-.5 3-1.5 4a7 7 0 0 1-4 2.2v.2c2.2.3 3.8 1 5 2.2a6.4 6.4 0 0 1 1.6 4.6c0 1.7-.5 3.1-1.4 4.4a9.7 9.7 0 0 1-4 3.1c-1.7.8-3.7 1.1-5.8 1.1Z"/></g><defs><linearGradient id="a" x1="20" x2="20" y1="0" y2="30.1" gradientUnits="userSpaceOnUse"><stop/><stop offset="1" stop-color="#3D3D3D"/></linearGradient><linearGradient id="b" x1="20" x2="20" y1="0" y2="30.1" gradientUnits="userSpaceOnUse"><stop/><stop offset="1" stop-color="#3D3D3D"/></linearGradient></defs></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 283 64"><path fill="black" d="M141 16c-11 0-19 7-19 18s9 18 20 18c7 0 13-3 16-7l-7-5c-2 3-6 4-9 4-5 0-9-3-10-7h28v-3c0-11-8-18-19-18zm-9 15c1-4 4-7 9-7s8 3 9 7h-18zm117-15c-11 0-19 7-19 18s9 18 20 18c6 0 12-3 16-7l-8-5c-2 3-5 4-8 4-5 0-9-3-11-7h28l1-3c0-11-8-18-19-18zm-10 15c2-4 5-7 10-7s8 3 9 7h-19zm-39 3c0 6 4 10 10 10 4 0 7-2 9-5l8 5c-3 5-9 8-17 8-11 0-19-7-19-18s8-18 19-18c8 0 14 3 17 8l-8 5c-2-3-5-5-9-5-6 0-10 4-10 10zm83-29v46h-9V5h9zM37 0l37 64H0L37 0zm92 5-27 48L74 5h10l18 30 17-30h10zm59 12v10l-3-1c-6 0-10 4-10 10v15h-9V17h9v9c0-5 6-9 13-9z"/></svg>
\ No newline at end of file
@tailwind base;
@tailwind components;
@tailwind utilities;
:root {
--foreground-rgb: 0, 0, 0;
--background-start-rgb: 214, 219, 220;
--background-end-rgb: 255, 255, 255;
}
@media (prefers-color-scheme: dark) {
:root {
--foreground-rgb: 255, 255, 255;
--background-start-rgb: 0, 0, 0;
--background-end-rgb: 0, 0, 0;
}
}
body {
color: rgb(var(--foreground-rgb));
background: linear-gradient(
to bottom,
transparent,
rgb(var(--background-end-rgb))
)
rgb(var(--background-start-rgb));
}
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
'./pages/**/*.{js,ts,jsx,tsx}',
'./components/**/*.{js,ts,jsx,tsx}',
'./app/**/*.{js,ts,jsx,tsx}',
],
theme: {
extend: {
backgroundImage: {
'gradient-radial': 'radial-gradient(var(--tw-gradient-stops))',
'gradient-conic':
'conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))',
},
},
},
plugins: [],
}
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
## Getting Started
First, run the development server:
```bash
npm run dev
# or
yarn dev
# or
pnpm dev
```
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file.
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.ts`.
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
## Learn More
To learn more about Next.js, take a look at the following resources:
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
## Deploy on Vercel
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# next.js
/.next/
/out/
# production
/build
# misc
.DS_Store
*.pem
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*
# local env files
.env*.local
# vercel
.vercel
# typescript
*.tsbuildinfo
next-env.d.ts
/// <reference types="next" />
/// <reference types="next/image-types/global" />
// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
}
module.exports = nextConfig
import '../styles/globals.css' import '@/styles/globals.css'
import type { AppProps } from 'next/app' import type { AppProps } from 'next/app'
function MyApp({ Component, pageProps }: AppProps) { export default function App({ Component, pageProps }: AppProps) {
return <Component {...pageProps} /> return <Component {...pageProps} />
} }
export default MyApp
import { Html, Head, Main, NextScript } from 'next/document'
export default function Document() {
return (
<Html lang="en">
<Head />
<body>
<Main />
<NextScript />
</body>
</Html>
)
}
import Image from 'next/image'
import { Inter } from 'next/font/google'
const inter = Inter({ subsets: ['latin'] })
export default function Home() {
return (
<main className="flex min-h-screen flex-col items-center justify-between p-24">
<div className="z-10 w-full max-w-5xl items-center justify-between font-mono text-sm lg:flex">
<p className="fixed left-0 top-0 flex w-full justify-center border-b border-gray-300 bg-gradient-to-b from-zinc-200 pb-6 pt-8 backdrop-blur-2xl dark:border-neutral-800 dark:bg-zinc-800 dark:bg-opacity-30 dark:from-inherit lg:static lg:w-auto lg:rounded-xl lg:border lg:bg-gray-200 lg:p-4 lg:dark:bg-zinc-800 lg:dark:bg-opacity-30">
Get started by editing&nbsp;
<code className="font-mono font-bold">app/page.tsx</code>
</p>
<div className="fixed bottom-0 left-0 flex h-48 w-full items-end justify-center bg-gradient-to-t from-white via-white dark:from-black dark:via-black lg:static lg:h-auto lg:w-auto lg:bg-none">
<a
className="pointer-events-none flex place-items-center gap-2 p-8 lg:pointer-events-auto lg:p-0"
href="https://vercel.com?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
By{' '}
<Image
src="/vercel.svg"
alt="Vercel Logo"
className="dark:invert"
width={100}
height={24}
priority
/>
</a>
</div>
</div>
<div className="before:bg-gradient-radial after:bg-gradient-conic relative flex place-items-center before:absolute before:h-[300px] before:w-[480px] before:-translate-x-1/2 before:rounded-full before:from-white before:to-transparent before:blur-2xl before:content-[''] after:absolute after:-z-20 after:h-[180px] after:w-[240px] after:translate-x-1/2 after:from-sky-200 after:via-blue-200 after:blur-2xl after:content-[''] before:dark:bg-gradient-to-br before:dark:from-transparent before:dark:to-blue-700 before:dark:opacity-10 after:dark:translate-x-2/3 after:dark:from-sky-900 after:dark:via-[#0141ff] after:dark:opacity-40 before:lg:h-[360px]">
<Image
className="relative dark:drop-shadow-[0_0_0.3rem_#ffffff70] dark:invert"
src="/next.svg"
alt="Next.js Logo"
width={180}
height={37}
priority
/>
<div className="before:bg-gradient-conic relative ml-4 flex h-20 w-20 items-center justify-center overflow-hidden rounded-xl shadow-lg before:absolute before:-z-10 before:h-[200%] before:w-[200%] before:animate-[spin_6s_linear_reverse_infinite] before:from-transparent before:via-black before:content-[''] after:absolute after:inset-[1px] after:-z-10 after:rounded-xl after:bg-gradient-to-br after:from-slate-50 after:to-slate-200 after:content-[''] motion-reduce:animate-none before:dark:via-white before:dark:to-transparent before:dark:opacity-50 after:dark:from-black after:dark:to-black">
<Image
className="dark:drop-shadow-[0_0_0.3rem_#ffffff70] dark:invert"
src="/thirteen.svg"
alt="13"
width={40}
height={31}
priority
/>
</div>
</div>
<div className="mb-32 grid text-center lg:mb-0 lg:grid-cols-3 lg:text-left">
<a
href="https://beta.nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800 hover:dark:bg-opacity-30"
target="_blank"
rel="noopener noreferrer"
>
<h2 className={`${inter.className} mb-3 text-2xl font-semibold`}>
Docs{' '}
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
-&gt;
</span>
</h2>
<p
className={`${inter.className} m-0 max-w-[34ch] text-sm opacity-50`}
>
Find in-depth information about Next.js features and API.
</p>
</a>
<a
href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800 hover:dark:bg-opacity-30"
target="_blank"
rel="noopener noreferrer"
>
<h2 className={`${inter.className} mb-3 text-2xl font-semibold`}>
Templates{' '}
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
-&gt;
</span>
</h2>
<p
className={`${inter.className} m-0 max-w-[34ch] text-sm opacity-50`}
>
Explore the Next.js 13 playground.
</p>
</a>
<a
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800 hover:dark:bg-opacity-30"
target="_blank"
rel="noopener noreferrer"
>
<h2 className={`${inter.className} mb-3 text-2xl font-semibold`}>
Deploy{' '}
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
-&gt;
</span>
</h2>
<p
className={`${inter.className} m-0 max-w-[34ch] text-sm opacity-50`}
>
Instantly deploy your Next.js site to a shareable URL with Vercel.
</p>
</a>
</div>
</main>
)
}
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 394 80"><path fill="#000" d="M262 0h68.5v12.7h-27.2v66.6h-13.6V12.7H262V0ZM149 0v12.7H94v20.4h44.3v12.6H94v21h55v12.6H80.5V0h68.7zm34.3 0h-17.8l63.8 79.4h17.9l-32-39.7 32-39.6h-17.9l-23 28.6-23-28.6zm18.3 56.7-9-11-27.1 33.7h17.8l18.3-22.7z"/><path fill="#000" d="M81 79.3 17 0H0v79.3h13.6V17l50.2 62.3H81Zm252.6-.4c-1 0-1.8-.4-2.5-1s-1.1-1.6-1.1-2.6.3-1.8 1-2.5 1.6-1 2.6-1 1.8.3 2.5 1a3.4 3.4 0 0 1 .6 4.3 3.7 3.7 0 0 1-3 1.8zm23.2-33.5h6v23.3c0 2.1-.4 4-1.3 5.5a9.1 9.1 0 0 1-3.8 3.5c-1.6.8-3.5 1.3-5.7 1.3-2 0-3.7-.4-5.3-1s-2.8-1.8-3.7-3.2c-.9-1.3-1.4-3-1.4-5h6c.1.8.3 1.6.7 2.2s1 1.2 1.6 1.5c.7.4 1.5.5 2.4.5 1 0 1.8-.2 2.4-.6a4 4 0 0 0 1.6-1.8c.3-.8.5-1.8.5-3V45.5zm30.9 9.1a4.4 4.4 0 0 0-2-3.3 7.5 7.5 0 0 0-4.3-1.1c-1.3 0-2.4.2-3.3.5-.9.4-1.6 1-2 1.6a3.5 3.5 0 0 0-.3 4c.3.5.7.9 1.3 1.2l1.8 1 2 .5 3.2.8c1.3.3 2.5.7 3.7 1.2a13 13 0 0 1 3.2 1.8 8.1 8.1 0 0 1 3 6.5c0 2-.5 3.7-1.5 5.1a10 10 0 0 1-4.4 3.5c-1.8.8-4.1 1.2-6.8 1.2-2.6 0-4.9-.4-6.8-1.2-2-.8-3.4-2-4.5-3.5a10 10 0 0 1-1.7-5.6h6a5 5 0 0 0 3.5 4.6c1 .4 2.2.6 3.4.6 1.3 0 2.5-.2 3.5-.6 1-.4 1.8-1 2.4-1.7a4 4 0 0 0 .8-2.4c0-.9-.2-1.6-.7-2.2a11 11 0 0 0-2.1-1.4l-3.2-1-3.8-1c-2.8-.7-5-1.7-6.6-3.2a7.2 7.2 0 0 1-2.4-5.7 8 8 0 0 1 1.7-5 10 10 0 0 1 4.3-3.5c2-.8 4-1.2 6.4-1.2 2.3 0 4.4.4 6.2 1.2 1.8.8 3.2 2 4.3 3.4 1 1.4 1.5 3 1.5 5h-5.8z"/></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" width="40" height="31" fill="none"><g opacity=".9"><path fill="url(#a)" d="M13 .4v29.3H7V6.3h-.2L0 10.5V5L7.2.4H13Z"/><path fill="url(#b)" d="M28.8 30.1c-2.2 0-4-.3-5.7-1-1.7-.8-3-1.8-4-3.1a7.7 7.7 0 0 1-1.4-4.6h6.2c0 .8.3 1.4.7 2 .4.5 1 .9 1.7 1.2.7.3 1.6.4 2.5.4 1 0 1.7-.2 2.5-.5.7-.3 1.3-.8 1.7-1.4.4-.6.6-1.2.6-2s-.2-1.5-.7-2.1c-.4-.6-1-1-1.8-1.4-.8-.4-1.8-.5-2.9-.5h-2.7v-4.6h2.7a6 6 0 0 0 2.5-.5 4 4 0 0 0 1.7-1.3c.4-.6.6-1.3.6-2a3.5 3.5 0 0 0-2-3.3 5.6 5.6 0 0 0-4.5 0 4 4 0 0 0-1.7 1.2c-.4.6-.6 1.2-.6 2h-6c0-1.7.6-3.2 1.5-4.5 1-1.3 2.2-2.3 3.8-3C25 .4 26.8 0 28.8 0s3.8.4 5.3 1.1c1.5.7 2.7 1.7 3.6 3a7.2 7.2 0 0 1 1.2 4.2c0 1.6-.5 3-1.5 4a7 7 0 0 1-4 2.2v.2c2.2.3 3.8 1 5 2.2a6.4 6.4 0 0 1 1.6 4.6c0 1.7-.5 3.1-1.4 4.4a9.7 9.7 0 0 1-4 3.1c-1.7.8-3.7 1.1-5.8 1.1Z"/></g><defs><linearGradient id="a" x1="20" x2="20" y1="0" y2="30.1" gradientUnits="userSpaceOnUse"><stop/><stop offset="1" stop-color="#3D3D3D"/></linearGradient><linearGradient id="b" x1="20" x2="20" y1="0" y2="30.1" gradientUnits="userSpaceOnUse"><stop/><stop offset="1" stop-color="#3D3D3D"/></linearGradient></defs></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 283 64"><path fill="black" d="M141 16c-11 0-19 7-19 18s9 18 20 18c7 0 13-3 16-7l-7-5c-2 3-6 4-9 4-5 0-9-3-10-7h28v-3c0-11-8-18-19-18zm-9 15c1-4 4-7 9-7s8 3 9 7h-18zm117-15c-11 0-19 7-19 18s9 18 20 18c6 0 12-3 16-7l-8-5c-2 3-5 4-8 4-5 0-9-3-11-7h28l1-3c0-11-8-18-19-18zm-10 15c2-4 5-7 10-7s8 3 9 7h-19zm-39 3c0 6 4 10 10 10 4 0 7-2 9-5l8 5c-3 5-9 8-17 8-11 0-19-7-19-18s8-18 19-18c8 0 14 3 17 8l-8 5c-2-3-5-5-9-5-6 0-10 4-10 10zm83-29v46h-9V5h9zM37 0l37 64H0L37 0zm92 5-27 48L74 5h10l18 30 17-30h10zm59 12v10l-3-1c-6 0-10 4-10 10v15h-9V17h9v9c0-5 6-9 13-9z"/></svg>
\ No newline at end of file
@tailwind base;
@tailwind components;
@tailwind utilities;
:root {
--foreground-rgb: 0, 0, 0;
--background-start-rgb: 214, 219, 220;
--background-end-rgb: 255, 255, 255;
}
@media (prefers-color-scheme: dark) {
:root {
--foreground-rgb: 255, 255, 255;
--background-start-rgb: 0, 0, 0;
--background-end-rgb: 0, 0, 0;
}
}
body {
color: rgb(var(--foreground-rgb));
background: linear-gradient(
to bottom,
transparent,
rgb(var(--background-end-rgb))
)
rgb(var(--background-start-rgb));
}
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
'./pages/**/*.{js,ts,jsx,tsx}',
'./components/**/*.{js,ts,jsx,tsx}',
'./app/**/*.{js,ts,jsx,tsx}',
],
theme: {
extend: {
backgroundImage: {
'gradient-radial': 'radial-gradient(var(--tw-gradient-stops))',
'gradient-conic':
'conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))',
},
},
},
plugins: [],
}
...@@ -13,7 +13,10 @@ ...@@ -13,7 +13,10 @@
"resolveJsonModule": true, "resolveJsonModule": true,
"isolatedModules": true, "isolatedModules": true,
"jsx": "preserve", "jsx": "preserve",
"incremental": true "incremental": true,
"paths": {
"@/*": ["./*"]
}
}, },
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"] "exclude": ["node_modules"]
......
...@@ -36,6 +36,7 @@ export const installTemplate = async ({ ...@@ -36,6 +36,7 @@ export const installTemplate = async ({
isOnline, isOnline,
template, template,
mode, mode,
tailwind,
eslint, eslint,
srcDir, srcDir,
importAlias, importAlias,
...@@ -47,7 +48,11 @@ export const installTemplate = async ({ ...@@ -47,7 +48,11 @@ export const installTemplate = async ({
*/ */
console.log('\nInitializing project with template:', template, '\n') console.log('\nInitializing project with template:', template, '\n')
const templatePath = path.join(__dirname, template, mode) const templatePath = path.join(__dirname, template, mode)
await cpy('**', root, { const copySource = ['**']
if (!eslint) copySource.push('!eslintrc.json')
if (!tailwind) copySource.push('!tailwind.config.js', '!postcss.config.js')
await cpy(copySource, root, {
parents: true, parents: true,
cwd: templatePath, cwd: templatePath,
rename: (name) => { rename: (name) => {
...@@ -135,11 +140,6 @@ export const installTemplate = async ({ ...@@ -135,11 +140,6 @@ export const installTemplate = async ({
) )
} }
if (!eslint) {
// remove un-necessary template file if eslint is not desired
await fs.promises.unlink(path.join(root, '.eslintrc.json'))
}
/** /**
* Create a package.json for the new project. * Create a package.json for the new project.
*/ */
...@@ -154,6 +154,7 @@ export const installTemplate = async ({ ...@@ -154,6 +154,7 @@ export const installTemplate = async ({
lint: 'next lint', lint: 'next lint',
}, },
} }
/** /**
* Write it to disk. * Write it to disk.
*/ */
...@@ -161,11 +162,13 @@ export const installTemplate = async ({ ...@@ -161,11 +162,13 @@ export const installTemplate = async ({
path.join(root, 'package.json'), path.join(root, 'package.json'),
JSON.stringify(packageJson, null, 2) + os.EOL JSON.stringify(packageJson, null, 2) + os.EOL
) )
/** /**
* These flags will be passed to `install()`, which calls the package manager * These flags will be passed to `install()`, which calls the package manager
* install process. * install process.
*/ */
const installFlags = { packageManager, isOnline } const installFlags = { packageManager, isOnline }
/** /**
* Default dependencies. * Default dependencies.
*/ */
...@@ -178,6 +181,7 @@ export const installTemplate = async ({ ...@@ -178,6 +181,7 @@ export const installTemplate = async ({
: '' : ''
}`, }`,
] ]
/** /**
* TypeScript projects will have type definitions and other devDependencies. * TypeScript projects will have type definitions and other devDependencies.
*/ */
...@@ -190,6 +194,13 @@ export const installTemplate = async ({ ...@@ -190,6 +194,13 @@ export const installTemplate = async ({
) )
} }
/**
* Add Tailwind CSS dependencies.
*/
if (tailwind) {
dependencies.push('tailwindcss', 'postcss', 'autoprefixer')
}
/** /**
* Default eslint dependencies. * Default eslint dependencies.
*/ */
......
import { PackageManager } from '../helpers/get-pkg-manager' import { PackageManager } from '../helpers/get-pkg-manager'
export type TemplateType = 'default' | 'app' export type TemplateType = 'default' | 'app' | 'default-tw' | 'app-tw'
export type TemplateMode = 'js' | 'ts' export type TemplateMode = 'js' | 'ts'
export interface GetTemplateFileArgs { export interface GetTemplateFileArgs {
...@@ -18,6 +18,7 @@ export interface InstallTemplateArgs { ...@@ -18,6 +18,7 @@ export interface InstallTemplateArgs {
template: TemplateType template: TemplateType
mode: TemplateMode mode: TemplateMode
eslint: boolean eslint: boolean
tailwind: boolean
srcDir: boolean srcDir: boolean
importAlias: string importAlias: string
} }
This diff is collapsed.
...@@ -67,7 +67,6 @@ const testedExamples = [ ...@@ -67,7 +67,6 @@ const testedExamples = [
'with-jest-babel', 'with-jest-babel',
'with-mdx', 'with-mdx',
'with-mdx-remote', 'with-mdx-remote',
'with-tailwindcss',
'with-turbopack', 'with-turbopack',
'with-vercel-fetch', 'with-vercel-fetch',
] ]
......
...@@ -48,6 +48,7 @@ describe('create next app', () => { ...@@ -48,6 +48,7 @@ describe('create next app', () => {
[ [
projectName, projectName,
'--js', '--js',
'--no-tailwind',
'--eslint', '--eslint',
'--no-src-dir', '--no-src-dir',
'--no-experimental-app', '--no-experimental-app',
...@@ -73,6 +74,7 @@ describe('create next app', () => { ...@@ -73,6 +74,7 @@ describe('create next app', () => {
[ [
projectName, projectName,
'--js', '--js',
'--no-tailwind',
'--eslint', '--eslint',
'--no-src-dir', '--no-src-dir',
'--no-experimental-app', '--no-experimental-app',
...@@ -91,7 +93,14 @@ describe('create next app', () => { ...@@ -91,7 +93,14 @@ describe('create next app', () => {
await useTempDir(async (cwd) => { await useTempDir(async (cwd) => {
const projectName = 'invalid-example-name' const projectName = 'invalid-example-name'
const res = await run( const res = await run(
[projectName, '--js', '--eslint', '--example', 'not a real example'], [
projectName,
'--js',
'--no-tailwind',
'--eslint',
'--example',
'not a real example',
],
{ {
cwd, cwd,
reject: false, reject: false,
...@@ -111,7 +120,14 @@ describe('create next app', () => { ...@@ -111,7 +120,14 @@ describe('create next app', () => {
await useTempDir(async (cwd) => { await useTempDir(async (cwd) => {
const projectName = 'valid-example' const projectName = 'valid-example'
const res = await run( const res = await run(
[projectName, '--js', '--eslint', '--example', 'basic-css'], [
projectName,
'--js',
'--no-tailwind',
'--eslint',
'--example',
'basic-css',
],
{ {
cwd, cwd,
} }
...@@ -134,7 +150,14 @@ describe('create next app', () => { ...@@ -134,7 +150,14 @@ describe('create next app', () => {
await useTempDir(async (cwd) => { await useTempDir(async (cwd) => {
const projectName = 'valid-example-without-package-json' const projectName = 'valid-example-without-package-json'
const res = await run( const res = await run(
[projectName, '--js', '--eslint', '--example', 'with-docker-compose'], [
projectName,
'--js',
'--no-tailwind',
'--eslint',
'--example',
'with-docker-compose',
],
{ {
cwd, cwd,
} }
...@@ -156,6 +179,7 @@ describe('create next app', () => { ...@@ -156,6 +179,7 @@ describe('create next app', () => {
[ [
projectName, projectName,
'--js', '--js',
'--no-tailwind',
'--eslint', '--eslint',
'--example', '--example',
`${exampleRepo}/${examplePath}`, `${exampleRepo}/${examplePath}`,
...@@ -186,6 +210,7 @@ describe('create next app', () => { ...@@ -186,6 +210,7 @@ describe('create next app', () => {
[ [
projectName, projectName,
'--js', '--js',
'--no-tailwind',
'--eslint', '--eslint',
'--example', '--example',
'https://github.com/vercel/nextjs-portfolio-starter/', 'https://github.com/vercel/nextjs-portfolio-starter/',
...@@ -216,6 +241,7 @@ describe('create next app', () => { ...@@ -216,6 +241,7 @@ describe('create next app', () => {
[ [
projectName, projectName,
'--js', '--js',
'--no-tailwind',
'--eslint', '--eslint',
'--example', '--example',
exampleRepo, exampleRepo,
...@@ -248,6 +274,7 @@ describe('create next app', () => { ...@@ -248,6 +274,7 @@ describe('create next app', () => {
[ [
projectName, projectName,
'--js', '--js',
'--no-tailwind',
'--eslint', '--eslint',
'--example', '--example',
`${exampleRepo}/${examplePath}`, `${exampleRepo}/${examplePath}`,
...@@ -283,6 +310,7 @@ describe('create next app', () => { ...@@ -283,6 +310,7 @@ describe('create next app', () => {
[ [
projectName, projectName,
'--js', '--js',
'--no-tailwind',
'--eslint', '--eslint',
'--example', '--example',
'__internal-testing-retry', '__internal-testing-retry',
...@@ -307,6 +335,7 @@ describe('create next app', () => { ...@@ -307,6 +335,7 @@ describe('create next app', () => {
[ [
projectName, projectName,
'--js', '--js',
'--no-tailwind',
'--eslint', '--eslint',
'--example', '--example',
'default', 'default',
...@@ -329,6 +358,7 @@ describe('create next app', () => { ...@@ -329,6 +358,7 @@ describe('create next app', () => {
[ [
projectName, projectName,
'--js', '--js',
'--no-tailwind',
'--eslint', '--eslint',
'--example', '--example',
'--no-src-dir', '--no-src-dir',
...@@ -366,6 +396,7 @@ describe('create next app', () => { ...@@ -366,6 +396,7 @@ describe('create next app', () => {
[ [
projectName, projectName,
'--js', '--js',
'--no-tailwind',
'--eslint', '--eslint',
'--no-src-dir', '--no-src-dir',
'--no-experimental-app', '--no-experimental-app',
...@@ -406,6 +437,7 @@ describe('create next app', () => { ...@@ -406,6 +437,7 @@ describe('create next app', () => {
[ [
'.', '.',
'--js', '--js',
'--no-tailwind',
'--eslint', '--eslint',
'--no-src-dir', '--no-src-dir',
'--no-experimental-app', '--no-experimental-app',
...@@ -431,6 +463,7 @@ describe('create next app', () => { ...@@ -431,6 +463,7 @@ describe('create next app', () => {
const res = await run( const res = await run(
[ [
'--js', '--js',
'--no-tailwind',
'--eslint', '--eslint',
'--no-src-dir', '--no-src-dir',
'--no-experimental-app', '--no-experimental-app',
...@@ -454,6 +487,7 @@ describe('create next app', () => { ...@@ -454,6 +487,7 @@ describe('create next app', () => {
[ [
projectName, projectName,
'--js', '--js',
'--no-tailwind',
'--eslint', '--eslint',
'--use-npm', '--use-npm',
'--no-src-dir', '--no-src-dir',
...@@ -477,6 +511,7 @@ describe('create next app', () => { ...@@ -477,6 +511,7 @@ describe('create next app', () => {
[ [
projectName, projectName,
'--js', '--js',
'--no-tailwind',
'--eslint', '--eslint',
'--use-npm', '--use-npm',
'--example', '--example',
...@@ -507,6 +542,7 @@ describe('create next app', () => { ...@@ -507,6 +542,7 @@ describe('create next app', () => {
[ [
projectName, projectName,
'--js', '--js',
'--no-tailwind',
'--eslint', '--eslint',
'--use-pnpm', '--use-pnpm',
'--no-src-dir', '--no-src-dir',
...@@ -548,6 +584,7 @@ describe('create next app', () => { ...@@ -548,6 +584,7 @@ describe('create next app', () => {
[ [
projectName, projectName,
'--js', '--js',
'--no-tailwind',
'--eslint', '--eslint',
'--use-pnpm', '--use-pnpm',
'--example', '--example',
...@@ -578,6 +615,7 @@ describe('create next app', () => { ...@@ -578,6 +615,7 @@ describe('create next app', () => {
[ [
projectName, projectName,
'--js', '--js',
'--no-tailwind',
'--eslint', '--eslint',
'--no-src-dir', '--no-src-dir',
'--no-experimental-app', '--no-experimental-app',
...@@ -610,6 +648,7 @@ describe('create next app', () => { ...@@ -610,6 +648,7 @@ describe('create next app', () => {
[ [
projectName, projectName,
'--js', '--js',
'--no-tailwind',
'--eslint', '--eslint',
'--example', '--example',
`${exampleRepo}/${examplePath}`, `${exampleRepo}/${examplePath}`,
...@@ -644,6 +683,7 @@ describe('create next app', () => { ...@@ -644,6 +683,7 @@ describe('create next app', () => {
[ [
projectName, projectName,
'--js', '--js',
'--no-tailwind',
'--eslint', '--eslint',
'--no-src-dir', '--no-src-dir',
'--no-experimental-app', '--no-experimental-app',
...@@ -683,6 +723,7 @@ describe('create next app', () => { ...@@ -683,6 +723,7 @@ describe('create next app', () => {
[ [
projectName, projectName,
'--js', '--js',
'--no-tailwind',
'--eslint', '--eslint',
'--example', '--example',
`${exampleRepo}/${examplePath}`, `${exampleRepo}/${examplePath}`,
...@@ -717,6 +758,7 @@ describe('create next app', () => { ...@@ -717,6 +758,7 @@ describe('create next app', () => {
[ [
projectName, projectName,
'--js', '--js',
'--no-tailwind',
'--eslint', '--eslint',
'--no-src-dir', '--no-src-dir',
'--no-experimental-app', '--no-experimental-app',
...@@ -756,6 +798,7 @@ describe('create next app', () => { ...@@ -756,6 +798,7 @@ describe('create next app', () => {
[ [
projectName, projectName,
'--js', '--js',
'--no-tailwind',
'--eslint', '--eslint',
'--example', '--example',
`${exampleRepo}/${examplePath}`, `${exampleRepo}/${examplePath}`,
......
...@@ -56,6 +56,41 @@ export const projectSpecification: ProjectSpecification = { ...@@ -56,6 +56,41 @@ export const projectSpecification: ProjectSpecification = {
devDeps: [], devDeps: [],
}, },
}, },
'default-tw': {
js: {
files: [
'jsconfig.json',
'pages/_app.js',
'pages/api/hello.js',
'pages/index.js',
'postcss.config.js',
'tailwind.config.js',
],
deps: ['autoprefixer', 'postcss', 'tailwindcss'],
devDeps: [],
},
ts: {
files: [
'next-env.d.ts',
'pages/_app.tsx',
'pages/api/hello.ts',
'pages/index.tsx',
'postcss.config.js',
'tailwind.config.js',
'tsconfig.json',
],
deps: [
'@types/node',
'@types/react-dom',
'@types/react',
'autoprefixer',
'postcss',
'tailwindcss',
'typescript',
],
devDeps: [],
},
},
app: { app: {
js: { js: {
deps: [], deps: [],
...@@ -79,6 +114,41 @@ export const projectSpecification: ProjectSpecification = { ...@@ -79,6 +114,41 @@ export const projectSpecification: ProjectSpecification = {
], ],
}, },
}, },
'app-tw': {
js: {
deps: ['autoprefixer', 'postcss', 'tailwindcss'],
devDeps: [],
files: [
'app/api/hello/route.js',
'app/layout.js',
'app/page.js',
'jsconfig.json',
'postcss.config.js',
'tailwind.config.js',
],
},
ts: {
deps: [
'@types/node',
'@types/react-dom',
'@types/react',
'autoprefixer',
'postcss',
'tailwindcss',
'typescript',
],
devDeps: [],
files: [
'app/api/hello/route.ts',
'app/layout.tsx',
'app/page.tsx',
'next-env.d.ts',
'postcss.config.js',
'tailwind.config.js',
'tsconfig.json',
],
},
},
} }
export type GetProjectSettingsArgs = { export type GetProjectSettingsArgs = {
......
...@@ -135,14 +135,17 @@ export const shouldBeTemplateProject = ({ ...@@ -135,14 +135,17 @@ export const shouldBeTemplateProject = ({
files: getProjectSetting({ template, mode, setting: 'files', srcDir }), files: getProjectSetting({ template, mode, setting: 'files', srcDir }),
}) })
projectFilesShouldNotExist({ // Tailwind templates share the same files (tailwind.config.js, postcss.config.js)
cwd, if (template !== 'app-tw' && template !== 'default-tw') {
projectName, projectFilesShouldNotExist({
files: mapSrcFiles( cwd,
projectSpecification[template][mode === 'js' ? 'ts' : 'js'].files, projectName,
srcDir files: mapSrcFiles(
), projectSpecification[template][mode === 'js' ? 'ts' : 'js'].files,
}) srcDir
),
})
}
projectDepsShouldBe({ projectDepsShouldBe({
type: 'dependencies', type: 'dependencies',
......
...@@ -80,6 +80,7 @@ describe('create-next-app templates', () => { ...@@ -80,6 +80,7 @@ describe('create-next-app templates', () => {
const childProcess = createNextApp( const childProcess = createNextApp(
[ [
projectName, projectName,
'--no-tailwind',
'--eslint', '--eslint',
'--no-src-dir', '--no-src-dir',
'--no-experimental-app', '--no-experimental-app',
...@@ -125,6 +126,7 @@ describe('create-next-app templates', () => { ...@@ -125,6 +126,7 @@ describe('create-next-app templates', () => {
[ [
projectName, projectName,
'--ts', '--ts',
'--no-tailwind',
'--eslint', '--eslint',
'--no-src-dir', '--no-src-dir',
'--no-experimental-app', '--no-experimental-app',
...@@ -151,6 +153,7 @@ describe('create-next-app templates', () => { ...@@ -151,6 +153,7 @@ describe('create-next-app templates', () => {
[ [
projectName, projectName,
'--ts', '--ts',
'--no-tailwind',
'--eslint', '--eslint',
'--src-dir', '--src-dir',
'--no-experimental-app', '--no-experimental-app',
...@@ -178,7 +181,7 @@ describe('create-next-app templates', () => { ...@@ -178,7 +181,7 @@ describe('create-next-app templates', () => {
await useTempDir(async (cwd) => { await useTempDir(async (cwd) => {
const projectName = 'typescript-test' const projectName = 'typescript-test'
const childProcess = createNextApp( const childProcess = createNextApp(
[projectName, '--ts', '--eslint'], [projectName, '--ts', '--no-tailwind', '--eslint'],
{ {
cwd, cwd,
env: { env: {
...@@ -204,6 +207,7 @@ describe('create-next-app templates', () => { ...@@ -204,6 +207,7 @@ describe('create-next-app templates', () => {
[ [
projectName, projectName,
'--js', '--js',
'--no-tailwind',
'--eslint', '--eslint',
'--no-src-dir', '--no-src-dir',
'--no-experimental-app', '--no-experimental-app',
...@@ -232,6 +236,7 @@ describe('create-next-app templates', () => { ...@@ -232,6 +236,7 @@ describe('create-next-app templates', () => {
[ [
projectName, projectName,
'--js', '--js',
'--no-tailwind',
'--eslint', '--eslint',
'--src-dir', '--src-dir',
'--no-experimental-app', '--no-experimental-app',
...@@ -269,6 +274,7 @@ describe('create-next-app templates', () => { ...@@ -269,6 +274,7 @@ describe('create-next-app templates', () => {
[ [
projectName, projectName,
'--ts', '--ts',
'--no-tailwind',
'--eslint', '--eslint',
'--no-src-dir', '--no-src-dir',
'--no-experimental-app', '--no-experimental-app',
...@@ -302,9 +308,58 @@ describe('create-next-app templates', () => { ...@@ -302,9 +308,58 @@ describe('create-next-app templates', () => {
`) `)
}) })
}) })
it('should prompt user to choose if --tailwind or --no-tailwind is not provided', async () => {
await useTempDir(async (cwd) => {
const projectName = 'choose-tailwind'
/**
* Start the create-next-app call.
*/
const childProcess = createNextApp(
[
projectName,
'--js',
'--eslint',
'--no-src-dir',
'--no-experimental-app',
`--import-alias=@/*`,
],
{
cwd,
},
testVersion
)
/**
* Wait for the prompt to display.
*/
// await new Promise((resolve) => setTimeout(resolve, 1000));
/**
* Bind the exit listener.
*/
await new Promise<void>((resolve, reject) => {
childProcess.on('exit', async (exitCode) => {
expect(exitCode).toBe(0)
/**
* Verify it correctly emitted a Tailwind project by looking for tailwind.config.js.
*/
projectFilesShouldExist({
cwd,
projectName,
files: ['tailwind.config.js'],
})
resolve()
})
/**
* Simulate "N" for Tailwind.
*/
childProcess.stdin.write('N\n')
})
})
})
}) })
describe('create-next-app --experimental-app-dir', () => { describe('create-next-app --experimental-app', () => {
if (!process.env.NEXT_TEST_CNA && process.env.NEXT_TEST_JOB) { if (!process.env.NEXT_TEST_CNA && process.env.NEXT_TEST_JOB) {
it('should skip when env is not set', () => {}) it('should skip when env is not set', () => {})
return return
...@@ -327,6 +382,7 @@ describe('create-next-app --experimental-app-dir', () => { ...@@ -327,6 +382,7 @@ describe('create-next-app --experimental-app-dir', () => {
[ [
projectName, projectName,
'--ts', '--ts',
'--no-tailwind',
'--experimental-app', '--experimental-app',
'--eslint', '--eslint',
'--no-src-dir', '--no-src-dir',
...@@ -356,6 +412,7 @@ describe('create-next-app --experimental-app-dir', () => { ...@@ -356,6 +412,7 @@ describe('create-next-app --experimental-app-dir', () => {
[ [
projectName, projectName,
'--js', '--js',
'--no-tailwind',
'--experimental-app', '--experimental-app',
'--eslint', '--eslint',
'--no-src-dir', '--no-src-dir',
...@@ -386,6 +443,7 @@ describe('create-next-app --experimental-app-dir', () => { ...@@ -386,6 +443,7 @@ describe('create-next-app --experimental-app-dir', () => {
[ [
projectName, projectName,
'--js', '--js',
'--no-tailwind',
'--experimental-app', '--experimental-app',
'--eslint', '--eslint',
'--src-dir', '--src-dir',
...@@ -414,4 +472,39 @@ describe('create-next-app --experimental-app-dir', () => { ...@@ -414,4 +472,39 @@ describe('create-next-app --experimental-app-dir', () => {
) )
}) })
}) })
it('should create Tailwind CSS appDir projects with --tailwind', async () => {
await useTempDir(async (cwd) => {
const projectName = 'appdir-tailwind-test'
const childProcess = createNextApp(
[
projectName,
'--ts',
'--tailwind',
'--experimental-app',
'--eslint',
'--no-src-dir',
`--import-alias=@/*`,
],
{
cwd,
},
testVersion
)
const exitCode = await spawnExitPromise(childProcess)
expect(exitCode).toBe(0)
shouldBeTemplateProject({
cwd,
projectName,
template: 'app-tw',
mode: 'ts',
})
await startsWithoutError(
path.join(cwd, projectName),
['default', 'turbo'],
true
)
})
})
}) })
...@@ -250,90 +250,6 @@ describe('CSS Support', () => { ...@@ -250,90 +250,6 @@ describe('CSS Support', () => {
}) })
}) })
describe('Basic Tailwind CSS', () => {
const appDir = join(fixturesDir, 'with-tailwindcss')
beforeAll(async () => {
await remove(join(appDir, '.next'))
})
it('should compile successfully', async () => {
const { code, stdout } = await nextBuild(appDir, [], {
stdout: true,
})
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
expect(stdout).toContain('.css')
})
it(`should've compiled and prefixed`, async () => {
const cssFolder = join(appDir, '.next/static/css')
const files = await readdir(cssFolder)
const cssFiles = files.filter((f) => /\.css$/.test(f))
expect(cssFiles.length).toBe(1)
const cssContent = await readFile(join(cssFolder, cssFiles[0]), 'utf8')
expect(cssContent).toMatch(/object-right-bottom/) // look for tailwind's CSS
expect(cssContent).not.toMatch(/tailwind/) // ensure @tailwind was removed
// Contains a source map
expect(cssContent).toMatch(/\/\*#\s*sourceMappingURL=(.+\.map)\s*\*\//)
})
it(`should've emitted a source map`, async () => {
const cssFolder = join(appDir, '.next/static/css')
const files = await readdir(cssFolder)
const cssMapFiles = files.filter((f) => /\.css\.map$/.test(f))
expect(cssMapFiles.length).toBe(1)
})
})
describe('Tailwind and Purge CSS', () => {
const appDir = join(fixturesDir, 'with-tailwindcss-and-purgecss')
beforeAll(async () => {
await remove(join(appDir, '.next'))
})
it('should compile successfully', async () => {
const { code, stdout } = await nextBuild(appDir, [], {
stdout: true,
})
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
})
it(`should've compiled and prefixed`, async () => {
const cssFolder = join(appDir, '.next/static/css')
const files = await readdir(cssFolder)
const cssFiles = files.filter((f) => /\.css$/.test(f))
expect(cssFiles.length).toBe(1)
const cssContent = await readFile(join(cssFolder, cssFiles[0]), 'utf8')
expect(cssContent).not.toMatch(/object-right-bottom/) // this was unused and should be gone
expect(cssContent).toMatch(/text-blue-500/) // this was used
expect(cssContent).not.toMatch(/tailwind/) // ensure @tailwind was removed
// Contains a source map
expect(cssContent).toMatch(/\/\*#\s*sourceMappingURL=(.+\.map)\s*\*\//)
})
it(`should've emitted a source map`, async () => {
const cssFolder = join(appDir, '.next/static/css')
const files = await readdir(cssFolder)
const cssMapFiles = files.filter((f) => /\.css\.map$/.test(f))
expect(cssMapFiles.length).toBe(1)
})
})
// https://github.com/vercel/next.js/issues/18557 // https://github.com/vercel/next.js/issues/18557
describe('CSS page transition inject <style> with nonce so it works with CSP header', () => { describe('CSS page transition inject <style> with nonce so it works with CSP header', () => {
const appDir = join(fixturesDir, 'csp-style-src-nonce') const appDir = join(fixturesDir, 'csp-style-src-nonce')
......
import '../styles/global.scss'
export default function MyApp({ Component, pageProps }) {
return <Component {...pageProps} />
}
import Link from 'next/link'
const links = [
{ href: 'https://github.com/vercel/next.js', label: 'GitHub' },
{ href: 'https://nextjs.org/docs', label: 'Docs' },
]
function Nav() {
return (
<nav>
<ul className="flex justify-between items-center p-8">
<li>
<Link href="/" className="text-blue-500 no-underline">
Home
</Link>
</li>
<ul className="flex justify-between items-center">
{links.map(({ href, label }) => (
<li key={`${href}${label}`} className="ml-4">
<a href={href} className="btn-blue no-underline">
{label}
</a>
</li>
))}
</ul>
</ul>
</nav>
)
}
export default () => (
<div>
<Nav />
<div className="hero">
<h1 className="title">Next.js + Tailwind CSS + PurgeCSS</h1>
</div>
</div>
)
const path = require('path')
module.exports = {
plugins: [
'tailwindcss',
[
'@fullhuman/postcss-purgecss',
{
content: [path.join(__dirname, './pages/**/*.{js,jsx,ts,tsx}')],
defaultExtractor: (content) => content.match(/[A-Za-z0-9-_:/]+/g) || [],
},
],
],
}
{
"postcss": {
"plugins": {
"tailwindcss": {}
}
}
}
export default function Home() {
return <div />
}
@tailwind base;
@tailwind components;
@tailwind utilities;
...@@ -403,87 +403,4 @@ describe('SCSS Support', () => { ...@@ -403,87 +403,4 @@ describe('SCSS Support', () => {
expect(currentColor).toMatchInlineSnapshot(`"rgb(0, 128, 0)"`) expect(currentColor).toMatchInlineSnapshot(`"rgb(0, 128, 0)"`)
}) })
}) })
describe('Basic Tailwind CSS', () => {
const appDir = join(fixturesDir, 'with-tailwindcss')
beforeAll(async () => {
await remove(join(appDir, '.next'))
})
it('should compile successfully', async () => {
const { code, stdout } = await nextBuild(appDir, [], {
stdout: true,
})
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
})
it(`should've compiled and prefixed`, async () => {
const cssFolder = join(appDir, '.next/static/css')
const files = await readdir(cssFolder)
const cssFiles = files.filter((f) => /\.css$/.test(f))
expect(cssFiles.length).toBe(1)
const cssContent = await readFile(join(cssFolder, cssFiles[0]), 'utf8')
expect(cssContent).toMatch(/object-right-bottom/) // look for tailwind's CSS
expect(cssContent).not.toMatch(/tailwind/) // ensure @tailwind was removed
// Contains a source map
expect(cssContent).toMatch(/\/\*#\s*sourceMappingURL=(.+\.map)\s*\*\//)
})
it(`should've emitted a source map`, async () => {
const cssFolder = join(appDir, '.next/static/css')
const files = await readdir(cssFolder)
const cssMapFiles = files.filter((f) => /\.css\.map$/.test(f))
expect(cssMapFiles.length).toBe(1)
})
})
describe('Tailwind and Purge CSS', () => {
const appDir = join(fixturesDir, 'with-tailwindcss-and-purgecss')
beforeAll(async () => {
await remove(join(appDir, '.next'))
})
it('should compile successfully', async () => {
const { code, stdout } = await nextBuild(appDir, [], {
stdout: true,
})
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
})
it(`should've compiled and prefixed`, async () => {
const cssFolder = join(appDir, '.next/static/css')
const files = await readdir(cssFolder)
const cssFiles = files.filter((f) => /\.css$/.test(f))
expect(cssFiles.length).toBe(1)
const cssContent = await readFile(join(cssFolder, cssFiles[0]), 'utf8')
expect(cssContent).not.toMatch(/object-right-bottom/) // this was unused and should be gone
expect(cssContent).toMatch(/text-blue-500/) // this was used
expect(cssContent).not.toMatch(/tailwind/) // ensure @tailwind was removed
// Contains a source map
expect(cssContent).toMatch(/\/\*#\s*sourceMappingURL=(.+\.map)\s*\*\//)
})
it(`should've emitted a source map`, async () => {
const cssFolder = join(appDir, '.next/static/css')
const files = await readdir(cssFolder)
const cssMapFiles = files.filter((f) => /\.css\.map$/.test(f))
expect(cssMapFiles.length).toBe(1)
})
})
}) })
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment