vite-typescript-tailwind-rollup-npm-package-template Tailwind Templates

Vite Typescript Tailwind Rollup Npm Package Template

šŸŽÆ Vite TypeScript Tailwind Rollup NPM Package Template

A modern, production-ready template for building and publishing React component libraries with TypeScript, TailwindCSS, and Rollup.

✨ Features

  • TypeScript Support: Built-in TypeScript configuration for type safety
  • TailwindCSS Integration: Utility-first CSS framework setup
  • Rollup Configuration: Optimized bundling for NPM packages
  • Development Tools: ESLint and Prettier pre-configured
  • Modern Toolchain: Vite for development, Rollup for production builds
  • Optimized Builds: Tree-shaking and minimal bundle size

šŸš€ Getting Started

Installation

Clone this template and install dependencies:

git clone https://github.com/yourusername/your-template-name.git
cd your-template-name
npm install

Development Scripts

This template includes several pre-configured npm scripts to help you develop, build, and maintain your package:

# Clean the dist directory
npm run clean

# Build the package for production
npm run build

# Lint TypeScript files
npm run lint

# Fix linting issues automatically
npm run lint:fix

# Format code using Prettier
npm run format

# Type check without emitting files
npm run typecheck

Usage

  1. Development:

    • Write your components in the src directory
    • Use TypeScript for type safety
    • Style with TailwindCSS utility classes
  2. Building:

    • Run npm run build to create a production build
    • Output will be in the dist directory
    • Includes both ESM and CJS formats
  3. Publishing:

    • Update package.json with your package details
    • Ensure your exports and main fields are correctly set
    • Run npm publish to publish to NPM

šŸ“¦ Project Structure

your-package-name/
ā”œā”€ā”€ dist/               # Built package output
ā”œā”€ā”€ src/               # Source code
│   ā”œā”€ā”€ components/    # React components
│   ā”œā”€ā”€ utils/        # Utility functions
│   └── index.ts      # Main entry point
ā”œā”€ā”€ rollup.config.js   # Rollup configuration
ā”œā”€ā”€ tsconfig.json     # TypeScript configuration
ā”œā”€ā”€ .eslintrc.js      # ESLint configuration
└── tailwind.config.js # TailwindCSS configuration

āš™ļø Configuration

TypeScript

The template includes a pre-configured tsconfig.json for React and modern JavaScript features. Modify as needed for your use case.

Rollup

The Rollup configuration supports:

  • TypeScript compilation
  • TailwindCSS processing
  • Multiple output formats (ESM, CJS)
  • External dependencies handling
  • Source maps generation

TailwindCSS

TailwindCSS is configured with:

  • JIT mode enabled
  • Custom theme support
  • Optimized production builds
  • PurgeCSS integration

šŸ¤ Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

šŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

šŸ™ Acknowledgments

šŸ“« Support

For support, please open an issue in the GitHub repository

Top categories

Loading Svelte Themes