tailcss
v0.0.2
Published
javascript typescript function to get isolated and flexible tailwind like API for your Design System
Maintainers
Readme
tailcss - Tailwind-like API for Design Systems
A JavaScript/TypeScript library that provides an isolated and flexible Tailwind-like API for building design systems. Create customizable, reusable design tokens with a powerful utility-first approach.
Features
- 🎨 Design System First - Built specifically for design systems and component libraries
- 📦 Multiple Export Formats - ES modules, UMD, and CommonJS
- 🔧 TypeScript Support - Fully typed with TypeScript
- ⚡ Zero Dependencies - Lightweight and dependency-free
- 📚 Storybook Ready - Includes Storybook for component documentation
- 🧹 Code Quality - ESLint, Stylelint, and Prettier configured
Installation
npm install tailcss
# or
pnpm install tailcss
# or
yarn add tailcssUsage
import tailcss from 'tailcss';
// Combine utility classes
const className = tailcss('flex', 'flex-row', 'gap-4', 'p-8');
// Result: 'flex flex-row gap-4 p-8'Development
Setup
Install dependencies:
pnpm installAvailable Scripts
pnpm dev- Start Vite dev serverpnpm build- Build the library (TypeScript + Vite)pnpm preview- Preview production buildpnpm storybook- Start Storybook dev server (port 6006)pnpm build:storybook- Build Storybook for productionpnpm test- Run tests with Vitestpnpm test:ui- Run tests with Vitest UI dashboard
Code Quality
pnpm lint- Run ESLintpnpm lint:fix- Fix ESLint issuespnpm style- Check CSS/SCSS with Stylelintpnpm style:fix- Fix style issuespnpm format- Format code with Prettierpnpm format:check- Check formatting without modifying
Project Structure
tailcss/
├── src/
│ ├── __tests__/ # Test files
│ │ └── tailcss.test.ts
│ ├── components/ # React components
│ │ ├── Button.tsx
│ │ └── Button.stories.ts
│ ├── docs/ # Documentation stories
│ │ └── tailcss.stories.tsx
│ └── index.ts # Main entry point
├── .storybook/ # Storybook configuration
├── dist/ # Build output
├── .eslintrc.js # ESLint configuration
├── .prettierrc.json # Prettier configuration
├── .stylelintrc.json # Stylelint configuration
├── tsconfig.json # TypeScript configuration
├── vite.config.ts # Vite configuration
├── vitest.config.ts # Vitest configuration
└── package.jsonTechnologies
- TypeScript - For type safety
- Vite - Fast build tool and dev server
- React - For component examples and Storybook
- Storybook - Component documentation
- Vitest - Unit testing framework
- ESLint - Code linting
- Stylelint - CSS/SCSS linting
- Prettier - Code formatting
Build Output
The library is built with multiple export formats:
- ES Module -
dist/tailcss.js(default) - UMD -
dist/tailcss.umd.js(universal) - CommonJS -
dist/tailcss.cjs(Node.js)
Contributing
- Create a feature branch
- Make your changes
- Run
pnpm formatandpnpm lint:fixto ensure code quality - Commit your changes
- Open a pull request
License
Apache-2.0
Author
Jean-Michel FRANCOIS
