Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

install tailwind nextjs

//Code from Tailwind docs - https://tailwindcss.com/docs/guides/nextjs

//Terminal - Start your project
npx create-next-app my-project
cd my-project

//Terminal - Install Tailwind
npm install -D tailwindcss postcss autoprefixer
npx tailwindcss init -p

//Create tailwind.config.js
module.exports = {
  content: [
    "./pages/**/*.{js,ts,jsx,tsx}",
    "./components/**/*.{js,ts,jsx,tsx}",
  ],
  theme: {
    extend: {},
  },
  plugins: [],
}

//Add Tailwind to your globals.css file
@tailwind base;
@tailwind components;
@tailwind utilities;

//Terminal - Initiate your project
npm run dev

//START USING TAILWIND!
export default function ExampleComponent() {
  return (
    <h1 className="text-3xl font-bold underline">
      Hello from Tailwind!
    </h1>
  )
}

//Extra - Install Tailwind Intellisense from VS Code for
//an amazing experience!
Source by tailwindcss.com #
 
PREVIOUS NEXT
Tagged: #install #tailwind #nextjs
ADD COMMENT
Topic
Name
1+2 =