NextJS is a javascript-based Reactjs based front-end tool to build SEO-based web projects which meats the basic optimization for the search engine like google, bing, yahoo, etc.
NextJS
Some advantages rather than ReactJS in NextJS projects like:-
- Zero Config:- build-in automatic typescript support and integrated type checking.
- File System Based Dynamic Routing:- In the NextJS project does not require routing because it uses file structure as a routing system.
- API Routes:- Quickly build back-end application endpoints, leveraging hot-reloading and a unified build pipeline.
Tailwind CSS
Tailwind CSS is a class-based CSS framework that you can use to create multiple device style based on classes and it is based on css3 which have many types of classes like breakpoint classes, typography, grid, flex, spacing, sizing, width, height, and many other classes available click here.
How to setup Nextjs with the tailwind CSS
Firstly you can install NextJS in the directory using the following command:
npx create-next-app@latest project_name # or yarn create next-app project_name
If you are using typescript to run the following command:-
npx create-next-app@latest project_name --typescript # or yarn create next-app project_name --typescript
After installing go to the project directory in cmd and run the following command to test the project is working.
npm run dev # Starts the development server. npm run build # Builds the app for production. npm start # Runs the built app in production mode.
After running the command it will run on the http://localhost:3000 port in the local system.
And the directory structure of the NextJS is:-
npm install -D tailwindcss postcss autoprefixer npx tailwindcss init -p
module.exports = { content: [ "./pages/**/*.{js,ts,jsx,tsx}", "./components/**/*.{js,ts,jsx,tsx}", ], theme: { extend: {}, }, plugins: [], }
@tailwind base; @tailwind components; @tailwind utilities;
0 Comments