This is a sample project (a web music player) for the Open Campus Frontend Developer Programm. It uses vite, react and tailwindcss.
The state after the course session can be found in the after-course
Branch.
The state after the setup can be found in the after-setup
Branch.
These steps explain how to setup an empty project with vite, react and tailwindcss. These steps were also used to create this sample project.
- Create vite react app (change music-player to the name of your project)
yarn create @vitejs/app music-player --template react
- Follow the instructions printed in your terminal. Mine were:
cd music-player
yarn
yarn dev
- Open the project in the editor of your choice. Open
localhost:3000
in your browser.
- Install Tailwind dependecies (as dev dependencies with
-D
):
yarn add -D tailwindcss@latest postcss@latest autoprefixer@latest
- Init Tailwind
npx tailwindcss init -p
- This creates
tailwind.config.js
andpostcss.config.js
- Open
tailwind.config.js
to setup purging and just-in-time mode
//...
purge: ["./index.html", "./src/**/*.{js,jsx}"],
mode: "jit",
//...
- Remove everything in
index.css
and include Tailwind inindex.css
/* ./src/index.css */
@tailwind base;
@tailwind components;
@tailwind utilities;
- Remove
App.css
andlogo.svg
and adjustApp.js
Change the App.js to his
import React from "react";
function App() {
return (
<div className="text-7xl font-black animate-bounce mt-8">
Let's get started ๐
</div>
);
}
export default App;
-
(optional) Add the Tailwind CSS IntelliSense Extension if you're using vscode.
-
You are ready to go ๐. Check your browser.