- M1 Mac
yarn dev
access to http://localhost:3000/
execute the command
# yarn
yarn create next-app next-ts-tailwind --typescript
# npm
npx create-next-app@latest --ts
reference: https://nextjs.org/docs/basic-features/typescript
execute the command
# yarn
yarn add -D tailwindcss@latest postcss@latest autoprefixer@latest
# npm
npm install -D tailwindcss@latest postcss@latest autoprefixer@latest
reference: https://fwywd.com/tech/next-tailwind
execute the command
# yarn
yarn tailwindcss init -p
# npm
npx tailwindcss init -p
reference: https://fwywd.com/tech/next-tailwind
add the code
module.exports = {
+ mode: 'jit',
- purge: [],
+ purge: ['./pages/**/*.{js,ts,jsx,tsx}', './components/**/*.{js,ts,jsx,tsx}'],
darkMode: false, // or 'media' or 'class'
theme: {
extend: {},
},
variants: {
extend: {},
},
plugins: [],
}
reference: https://fwywd.com/tech/next-tailwind
edit pages/_app.tsx
- import '../styles/globals.css'
+ import 'tailwindcss/tailwind.css';
import type { AppProps } from 'next/app'
function MyApp({ Component, pageProps }: AppProps) {
return <Component {...pageProps} />
}
export default MyApp