Installation Next.js
Step-by-step guide to install Blockies Animate in your Next.js project
Follow these steps to set up your project with Tailwind CSS, clsx, and recommended utilities for Next.js.
1. Install Tailwind CSS v4
Install Tailwind CSS, @tailwindcss/postcss, and their peer dependencies:
pnpm add tailwindcss @tailwindcss/postcss postcss
2. Configure PostCSS Plugins
Create a postcss.config.mjs
file in the root of your project and add the @tailwindcss/postcss
plugin:
// postcss.config.mjs
const config = {
plugins: {
"@tailwindcss/postcss": {},
},
};
export default config;
3. Import Tailwind CSS
Add an import to your global CSS file (e.g., ./src/app/globals.css
) to include Tailwind CSS:
@import "tailwindcss";
4. Install clsx
Install the clsx library to easily handle conditional class names:
pnpm add clsx
5. Create a utilities file
Create a file named utils.ts
inside the lib
folder with the following content:
import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";
// utils.ts
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}
Done! Your Next.js project is now ready to use Tailwind CSS and modern class utilities.
References: