A high-performance Tailwind CSS alternative built with Zig, targeting feature parity with Tailwind 4.1.
π Blazing Fast - Built with Zig for maximum performance β‘ Zero Dependencies - No Node.js required (optional npm wrapper for convenience) π― Type-Safe - Compile-time safety guarantees π₯ Hot Reload - Lightning-fast rebuilds with intelligent caching π¨ Tailwind Compatible - Designed for feature parity with Tailwind 4.1 π§© Extensible - Powerful plugin system
This project is in active development. Phase 1 (Project Setup & Core Architecture) is complete.
See TODO.md for the comprehensive implementation roadmap.
git clone https://github.com/yourusername/headwind.git
cd headwind
zig buildnpm install -g @headwind/headwindbrew install headwindheadwind initThis creates a headwind.config.json file:
{
"content": {
"files": [
"src/**/*.{html,js,jsx,ts,tsx,vue,svelte}"
]
},
"theme": {
"extend": {}
},
"plugins": []
}headwind buildheadwind watchHeadwind uses zig-config for configuration management, supporting multiple formats and sources.
Create headwind.config.json in your project root:
{
"content": {
"files": ["src/**/*.{html,js,jsx,ts,tsx}"],
"exclude": ["node_modules/**", "dist/**"]
},
"theme": {
"colors": {
"primary": "#3b82f6",
"secondary": "#8b5cf6"
},
"extend": {
"spacing": {
"128": "32rem"
}
}
},
"darkMode": {
"strategy": "class",
"className": "dark"
},
"build": {
"output": "dist/headwind.css",
"minify": true,
"sourcemap": true
},
"plugins": []
}Override configuration with environment variables:
export HEADWIND_BUILD_MINIFY=true
export HEADWIND_BUILD_OUTPUT=dist/styles.css
headwind buildpub const HeadwindConfig = struct {
content: ContentConfig,
theme: ThemeConfig,
build: BuildConfig,
darkMode: DarkModeConfig,
plugins: []PluginConfig,
prefix: []const u8 = "",
separator: []const u8 = ":",
};See src/config/schema.zig for the full schema.
headwind build # Build CSS from source files
headwind watch # Watch for changes and rebuild (coming soon)
headwind init # Initialize configuration file
headwind check # Validate configuration
headwind clean # Clean cache
headwind version # Show version information
headwind help # Show help messageHeadwind is designed with performance and safety in mind:
- Core - Fundamental types and memory management
- Config - Configuration loading and validation
- Scanner - File system scanning and class extraction
- Parser - CSS class name parsing and validation
- Generator - CSS rule generation and optimization
- Cache - Intelligent caching system
- CLI - Command-line interface
Headwind uses Zig's allocator system with:
- Arena allocators for request-scoped memory
- String interning for deduplication
- Object pools for reusable allocations
- Zero-copy parsing where possible
- Multi-threaded file scanning
- Lock-free cache data structures
- SIMD-accelerated string matching (planned)
- Incremental builds with smart caching
- Parallel CSS generation
- Zig 0.12.0 or later
- zig-config (included as dependency)
# Build the project
zig build
# Run tests
zig build test
# Run benchmarks
zig build bench
# Format code
zig build fmt
# Cross-compile for all platforms
zig build crossheadwind/
βββ src/
β βββ main.zig # CLI entry point
β βββ headwind.zig # Library entry point
β βββ core/ # Core types and utilities
β β βββ types.zig
β β βββ allocator.zig
β βββ config/ # Configuration system
β β βββ schema.zig
β β βββ loader.zig
β βββ scanner/ # File scanning (planned)
β βββ parser/ # CSS parsing (planned)
β βββ generator/ # CSS generation (planned)
β βββ cache/ # Caching system (planned)
β βββ cli/ # CLI utilities (planned)
β βββ utils/ # Shared utilities
β βββ string.zig
βββ test/ # Tests
βββ examples/ # Example projects
βββ build.zig # Build configuration
βββ build.zig.zon # Dependency configuration
βββ TODO.md # Implementation roadmap
See TODO.md for the comprehensive roadmap with 650+ tasks organized into 17 phases.
- Project setup and build system
- Core architecture
- Configuration system with zig-config
- Memory management utilities
- String utilities
- CLI framework
- CSS scanning and parsing
- Utility class system
- Variant system
- Modern CSS features (Tailwind 4.1)
- Plugin system
- Performance optimization
- Testing and benchmarks
- Documentation and tooling
- Ecosystem integration
Target performance metrics vs Tailwind CSS:
- 10x faster cold start
- 5x faster incremental builds
- 50% lower memory usage
- Sub-millisecond class extraction
Contributions are welcome! Please see CONTRIBUTING.md (coming soon) for guidelines.
MIT License - see LICENSE for details.
- Inspired by Tailwind CSS
- Inspired by UnoCSS
- Built with Zig
- Configuration powered by zig-config
- Documentation: [Coming Soon]
- GitHub: https://github.com/yourusername/headwind
- Discord: [Coming Soon]
Built with β€οΈ and Zig