zig-utils/zig-headwind
A high-performance Tailwind CSS & UnoCSS alternative built with Zig.
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 build
npm install -g @headwind/headwind
brew install headwind
headwind init
This creates a headwind.config.json file:
{
"content": {
"files": [
"src/**/*.{html,js,jsx,ts,tsx,vue,svelte}"
]
},
"theme": {
"extend": {}
},
"plugins": []
}
headwind build
headwind watch
Headwind 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 build
pub 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 message
Headwind is designed with performance and safety in mind:
Headwind uses Zig's allocator system with:
# 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 cross
headwind/
├── 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.
Target performance metrics vs Tailwind CSS:
Contributions are welcome! Please see CONTRIBUTING.md (coming soon) for guidelines.
MIT License - see LICENSE for details.
Built with ❤️ and Zig