Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

BaseMax/tailwindcss-setup

Repository files navigation

Tailwind CSS Setup Example

This repository provides a minimal setup for integrating Tailwind CSS version 4 into a static HTML project, utilizing Vite for development and build processes. It serves as a foundational template for developers looking to implement Tailwind CSS with custom configurations and modern tooling.

πŸš€ Project Overview

This project demonstrates how to:

  • Set up Tailwind CSS v4 with Vite.
  • Customize the Tailwind configuration to include custom colors.
  • Build and serve the project locally using PHP's built-in server.

πŸ› οΈ Prerequisites

Ensure you have the following installed:

πŸ“ Project Structure

tailwindcss-setup/
β”œβ”€β”€ dist/ # Compiled output (HTML, CSS, JS)
β”œβ”€β”€ index.html # Main HTML page
β”œβ”€β”€ test.html # Secondary HTML page
β”œβ”€β”€ tailwind.config.js # Tailwind CSS configuration
β”œβ”€β”€ tailwind.css # Custom CSS file
β”œβ”€β”€ main.js # JavaScript entry point
└── package.json # Project metadata and dependencies

βš™οΈ Installation & Setup

  1. Clone the repository:

    git clone https://github.com/BaseMax/tailwindcss-setup.git
    cd tailwindcss-setup
  2. Install dependencies:

    npm install
  3. Initialize Tailwind CSS:

    npx tailwindcss init -p
  4. Configure Tailwind:

    Update tailwind.config.js to include custom colors:

    /** @type {import('tailwindcss').Config} */
    module.exports = {
     content: ['./*.html', './*.js'],
     theme: {
     extend: {
     colors: {
     'table-header': '#091a52',
     'highlight': '#ff5733',
     },
     },
     },
     safelist: ['bg-table-header', 'text-highlight'],
     plugins: [],
    };
  5. Create your CSS file:

    In tailwind.css, include the Tailwind directives:

    @tailwind base;
    @tailwind components;
    @tailwind utilities;
    @theme {
     --color-table-header: #091a52;
     --color-highlight: #ff5733;
    }
  6. Build the project:

    npm run build
  7. Serve the project locally:

    php -S localhost:4646 -t dist

    Visit http://localhost:4646 in your browser to view the project.

πŸ“„ Example Pages

  • index.html: The main landing page showcasing custom Tailwind styles.
  • test.html: A secondary page for testing purposes.

πŸ“š Resources

πŸ“„ License

This project is licensed under the MIT License.

Copyright 2025, Max Base

About

A minimal setup for using Tailwind CSS version 4 with static HTML pages, leveraging Vite for fast development and build processes. Designed as a starting template for developers to implement Tailwind with custom colors, utilities, and modern frontend tooling.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /