Skip to content

Instantly share code, notes, and snippets.

@anburocky3
Last active April 24, 2024 02:44
Show Gist options
  • Save anburocky3/5e566c9d569248882fe6ff40011072e1 to your computer and use it in GitHub Desktop.
Save anburocky3/5e566c9d569248882fe6ff40011072e1 to your computer and use it in GitHub Desktop.
Tailwind, Vite integration with Github-Pages deployment steps

TailwindCss-Vite

  1. Create project using the below commands.
npm create vite@latest my-project-name
> Vanilla
> JavaScript
npm install
npm run dev
npm install -D tailwindcss postcss autoprefixer
npx tailwindcss init -p
  1. Paste the below in the tailwind.config.js file
/** @type {import('tailwindcss').Config} */
export default {
  content: [
    "./index.html",
    "./**/*.{js,ts,jsx,tsx}",
  ],
  theme: {
    extend: {},
  },
  plugins: [],
}
  1. create main.css file and paste the below code
@tailwind base;
@tailwind components;
@tailwind utilities;
  1. Link the main.css file to index.html file

  2. create a new git repository and push all the file as-usual

  3. Go to package.json file add the below code

"homepage": "ur git repository link"
  1. create a new file naming "vite.config.js" & paste the below in that file
import { defineConfig } from 'vite'

export default defineConfig({
  base:"/...ur git repository name.../"
})
  1. Now run the below command
npm run build
  1. Go to .gitignore file and comment the dist line

  2. Go to terminal again and type these commands

npm run build
  1. Again git push...

  2. git subtree push --prefix dist origin gh-pages

now check ur output in git All the best😉

@sharif-22
Copy link

sharif-22 commented Jan 7, 2024

issue : change this path "./src/*/.{js,ts,jsx,tsx}", to -> "./src/**/*.{js,ts,jsx,tsx}", or "./**/*.{js,ts,jsx,tsx}",
and add

  • this content config to assets folder too

while setting up the project i forget to change this config

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment