Building a personal portfolio website is crucial for showcasing your skills, projects, and experiences to potential employers or clients. In this article, we will explore how to build and deploy a custom React portfolio using Vite.js and Tailwind CSS.
Firstly, let’s discuss why we are choosing Vite.js and Tailwind CSS for this project. Vite.js is a fast build tool for modern web development. It offers blazing fast development server startup, hot module replacement, and efficient production builds. Its zero-config setup makes it a great choice for quickly setting up a React project.
Tailwind CSS, on the other hand, is a utility-first CSS framework that provides a set of pre-defined classes for styling your application. It allows you to write concise and clean CSS without the need to write custom CSS classes and styles. This makes it easy to style your portfolio without spending too much time on CSS.
To start, make sure you have Node.js installed on your system. Open your terminal and run the following command to install Vite globally:
“`
npm install -g create-vite
“`
Once Vite is installed, create a new React project by running the following command:
“`
create-vite project-name –template react
“`
Navigate to the project directory:
“`
cd project-name
“`
Next, install the required dependencies by running:
“`
npm install tailwindcss postcss autoprefixer
“`
After the installation is complete, create a new `tailwind.config.js` file in the project root directory. Add the following code to configure Tailwind CSS:
“`javascript
module.exports = {
purge: [],
darkMode: false,
theme: {
extend: {},
},
variants: {},
plugins: [],
}
“`
Next, open the `index.css` file located in the `src` directory. Replace its contents with the following:
“`css
@import ‘tailwindcss/tailwind.css’;
“`
After this, rename the file to `index.css` so that it is picked up by Vite.
Now we can start building our portfolio. Create a new file named `Portfolio.js` in the `src` directory. In this file, write your portfolio overview content using React components:
“`jsx
import React from ‘react’;
const Portfolio = () => {
return (
Welcome to my portfolio
I am a front-end developer with experience in React and JavaScript.
);
};
export default Portfolio;
“`
Next, open the `App.js` file in the `src` directory. Replace its contents with the following code:
“`jsx
import React from ‘react’;
import Portfolio from ‘./Portfolio’;
const App = () => {
return
};
export default App;
“`
Now, we need to import the `index.css` file in the `main.js` file located in the `src` directory. Open the `main.js` file and add the following line at the top:
“`javascript
import ‘./index.css’;
“`
Lastly, open the `index.js` file in the `src` directory. Replace the rendering code with the following:
“`javascript
import React from ‘react’;
import ReactDOM from ‘react-dom’;
import App from ‘./App’;
ReactDOM.render(
document.getElementById(‘root’)
);
“`
Finally, navigate to the project directory in your terminal and run the command:
“`
npm run dev
“`
This will start the development server, and you should see your portfolio with the content you defined in `Portfolio.js` running on `localhost:3000`.
Now that our portfolio is ready, we can deploy it to a hosting service. One popular option is Vercel, which simplifies the deployment process. Follow these steps to deploy on Vercel:
1. Make sure you have the Vercel CLI installed by running `npm install -g vercel` in your terminal.
2. In your project directory, run the command `vercel login` to authenticate with Vercel.
3. Run `vercel` in your project directory. This command will guide you through the deployment process.
4. Once the deployment is successful, Vercel will provide you with a unique URL for your portfolio.
Congratulations! You have successfully built and deployed your custom React portfolio using Vite.js and Tailwind CSS. You can now customize and add more sections, projects, or any other content you’d like to showcase.
is anyone else getting an issue with the map method? it doesn't seem to output the array of data
🟢Ok, Cool Thanks, I did it. That was a good Starter tutorial to explain the whole structure of things. From now on, I will use React on Everything. I will put you on my Favorites list 🦾.
Excellent tutorial, thank you very much for this help. Greetings from Venezuela.
Uff complete ✅
36:47 My h1 and h2 not displaying at the center. Kindly help
video is unclear, my eyes are aching
Love the pacing of your tutorials! Not too slow, not too fast; just right.
Hey guys, do we need some extra setup if the React App is using routes (react-router-dom)?
Really nice, help a lot to understand how to use tailwind!! I made mine with maps for the menuItens, a little cleaner
very good tutorial, except that deploy on Hostinger is easy BUT not that fast. It took about an hour
The way you have explained I love it. Awesome 👌👌👌👌
Awesome
This tutorial is awesome! I was able to follow up and understand at least 80% of everything. This was so helpful I am new to react and tailwind and this makes such a difference. could you share some of the plug ins you use in VS code like the auto format and the auto population when you write in the className?
For those that Tailwind doesn't work, i've found the fix. I've been missing tailwindcss in the vite.config.js file.
So to fix it, your vite.config.js file should look like this:
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import tailwindcss from 'tailwindcss';
export default defineConfig({
plugins: [react(),tailwindcss()],
})
Tailwind doesn't work for some reason
Finally i found the npm installation of the text typing animation for VITE <3
What plugin to install to create automatic template in react components? Thank you
why do i get 6 vulnerabilities when i install the typing animation package???
Smashing
can anyone share the link of the background image of Main.jsx component.