Creating a simple website with Next.js and Tailwind CSS
Documentation: Next.js & TailwindCSS
Looking into, useStates, Props, & Hooks next
npm install next react react-dom
Add configuation scripts to package.json
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
}
npm install -D tailwindcss postcss autoprefixer
npx tailwindcss init -p
Remove any CSS in global.css
. Replace with Tailwind detrivatives.
@tailwind base;
@tailwind components;
@tailwind utilities;
Add postcss plugin to post.config.js
module.exports = {
plugins: {
'postcss-import': {},
tailwindcss: {},
autoprefixer: {},
},
}
Add the paths to all of your template files in tailwind.config.js
file.
module.exports = {
content: [
'./pages/**/*.{js,jsx,ts,tsx}',
'./components/**/*.{js,jsx,ts,tsx}'
],
}
npm run dev