Getting Started

Welcome to the Twigwind CSS Framework documentation. Twigwind is a utility-first CSS framework built with JavaScript for rapid prototyping and flexibility.

πŸ’‘ Tip: Use Twigwind with runtime CSS generation or build-time optimization.

Installation

NPM Package

npm install twigwind

CDN package

Add Twigwind to your HTML:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/helloadhavan/twigwind/src/css.css">
<script src="https://cdn.jsdelivr.net/gh/helloadhavan/twigwind/src/css.js" type="module"></script>

Initialize Twigwind after DOM content loads:

<script>
document.addEventListener("DOMContentLoaded", () => {
  document.querySelectorAll("[class]").forEach(el => Twigwind.twApply(el));
  Twigwind.twInject();
});
</script>
βœ… Twigwind is now active β€” you can use its classes directly in your HTML.

Build System (Optional)

For optimized CSS generation:

node build.js

This will generate optimized CSS files in the dist/ directory.

Usage

Here’s a quick example:

<h1 class="color-blue size-xl mb-20">Hello Twigwind</h1>
<div class="flex:row-center-center bg-green p-10">
  <div class="bg-purple p-5 mr-10">Item 1</div>
  <div class="bg-red p-5">Item 2</div>
</div>

Utilities

Twigwind includes utility classes for:

Examples

A section with hover effects:

<div class="flex:row-left-center">
  <div class="bg-cyan hover:bg-purple size-md mr-10 p-10">Hover Me</div>
  <div class="bg-lightBlue hover:bg-amber size-md p-10">Hover Me</div>
</div>

Framework Comparison

Feature / Framework W3.CSS Tailwind Bootstrap Twigwind
Ease of Learningβœ”οΈβŒβ­βœ”οΈ
Utility-First❌⭐❌⭐
Flexibilityβœ”οΈβ­βœ”οΈβ­
Responsiveβœ”οΈβ­β­β­
Prebuilt Componentsβœ”οΈβŒβ­βŒ
Lightweightβ­βœ”οΈβŒβ­
Communityβœ”οΈβ­β­βŒ
Integrationβ­βœ”οΈβœ”οΈβ­
JS IntegrationβŒβœ”οΈβœ”οΈβ­
Prototypingβœ”οΈβ­β­β­
⚠️ Note: Twigwind is still in development. Expect frequent updates.
❌ Deprecated: The flex-center class has been replaced with flex:row-center-center.