Contributing to Transform to Tailwind CSS Core
June 23, 2025 ยท View on GitHub
Thank you for your interest in contributing to Transform to Tailwind CSS Core! We welcome contributions from everyone.
๐ Getting Started
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/your-username/transform-to-tailwindcss-core.git cd transform-to-tailwindcss-core - Install dependencies:
pnpm install - Create a new branch for your feature or bugfix:
git checkout -b feature/your-feature-name
๐ ๏ธ Development
Project Structure
src/
โโโ index.ts # Main entry point
โโโ transformStyleToTailwindcss.ts # Core transformation function
โโโ toTailwindcss.ts # CSS to Tailwind mapping logic
โโโ transformer.ts # Style preprocessing
โโโ utils.ts # Utility functions
โโโ [property].ts # Individual CSS property handlers
Running Tests
# Run tests
pnpm test
# Run tests with coverage
pnpm test:coverage
# Run tests in watch mode
pnpm test --watch
Building
# Build the project
pnpm build
# Build and watch for changes
pnpm dev
Code Quality
# Lint code
pnpm lint
# Fix linting issues
pnpm lint:fix
# Format code
pnpm format
# Type checking
pnpm typecheck
# Run all checks
pnpm ci
๐ Writing Tests
We use Vitest for testing. When adding new features or fixing bugs, please include tests:
- Create test files in the
test/directory - Follow the naming convention:
[feature].test.ts - Test both successful conversions and edge cases
Example test structure:
import { describe, expect, it } from 'vitest'
import { transformStyleToTailwindcss } from '../src'
describe('feature description', () => {
it('should convert basic styles', () => {
const [result, unconverted] = transformStyleToTailwindcss('color: red')
expect(result).toBe('text-red-500')
expect(unconverted).toEqual([])
})
})
๐ง Adding New CSS Properties
To add support for a new CSS property:
- Create a new handler file in
src/[property].ts - Export the handler function that matches the property
- Import and register the handler in
src/toTailwindcss.ts - Add comprehensive tests in
test/[property].test.ts
Example handler structure:
// src/newProperty.ts
export function transformNewProperty(key: string, value: string): string {
// Transform logic here
return tailwindClass
}
๐ Pull Request Guidelines
Before submitting a pull request:
- Ensure all tests pass:
pnpm test - Run the full CI check:
pnpm ci - Update documentation if needed
- Add tests for new features
- Follow commit message conventions
Commit Message Format
We follow conventional commits:
feat:new featuresfix:bug fixesdocs:documentation changestest:test additions or updatesrefactor:code refactoringchore:maintenance tasks
Example: feat: add support for CSS grid properties
๐ Reporting Issues
When reporting bugs, please include:
- Clear description of the issue
- Steps to reproduce
- Expected vs actual behavior
- CSS input that caused the issue
- Environment details (Node.js version, etc.)
๐ก Feature Requests
For new features:
- Check existing issues to avoid duplicates
- Describe the use case clearly
- Provide examples of desired input/output
- Consider backward compatibility
๐ค Code of Conduct
Please be respectful and constructive in all interactions. We're here to build something great together!
๐ Getting Help
- GitHub Issues: For bugs and feature requests
- GitHub Discussions: For questions and general discussion
- Discord: Join our community (if available)
Thank you for contributing! ๐