<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
    <channel>
        <title>نوشته های Shervin Ghajar</title>
        <link>https://virgool.io/feed/@ssghajar.work</link>
        <description>Experienced Software Engineer with a demonstrated history of working in the computer software industry. Skilled in Front-End Development and Leadership, Application Development</description>
        <language>fa</language>
        <pubDate>2026-06-29 03:57:23</pubDate>
        <image>
            <url>https://files.virgool.io/upload/users/4448579/avatar/avatar.png?height=120&amp;width=120</url>
            <title>Shervin Ghajar</title>
            <link>https://virgool.io/@ssghajar.work</link>
        </image>

                    <item>
                <title>با کلاس‌های شلوغ Tailwind خداحافظی کن؛ با 🌲 Tailwind Tree آشنا شو</title>
                <link>https://virgool.io/@ssghajar.work/tailwind-tree-introduction-yegigdvulrra</link>
                <description>🌲 Stop Writing Long Tailwind Class Strings — Build a Tree InsteadIf you’ve ever stared at a massive, tangled Tailwind class string and thought “there has to be a better way” — you’re not alone.&lt;div className=&quot;bg-amber-500 text-nowrap hover:bg-slate-600 hover:text-clip md:focus:text-blue-700 md:hover:bg-gray-800 dark:bg-gray-900 dark:hover:bg-gray-700 ...&quot; /&gt;Unreadable. Unmaintainable. Unpleasant to work with.So I built Tailwind Tree — a way to write Tailwind classes that scales with complexity and matches the way your brain thinks about UI states.🌳 Introducing Tailwind TreeAfter years of building UIs with Tailwind CSS, I kept running into the same problem:As components grew, the class strings turned into dense, brittle walls of text.Variants nested inside variants.Responsive rules stacked on interactive states.Dark mode classes hidden inside 200-character strings.Tailwind Tree solves this by letting you write those classes as a structured tree instead of a chaotic blob.❌ The Problem With Long Class StringsHere’s a realistic scenario: a button with:Base stylingHover &amp; focus statesResponsive sizesActive &amp; disabled statesDark mode variantsTypical Tailwind:&lt;button className=&quot;px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600 focus:ring-2 focus:ring-blue-300 md:px-6 md:py-3 lg:text-lg active:bg-blue-700 disabled:opacity-50 dark:bg-blue-900 dark:hover:bg-blue-800&quot; /&gt;
Problems:1. Impossible to scan2. Easy to break3. Hard to maintain4. No real structureYour eyes bounce around trying to figure out what applies where.🌲 The Tailwind Tree SolutionWith Tailwind Tree, the same component looks like this:twTree([
  &#039;px-4 py-2 bg-blue-500 text-white rounded&#039;,
  {
    hover: &#039;bg-blue-600&#039;,
    focus: &#039;ring-2 ring-blue-300&#039;,
    active: &#039;bg-blue-700&#039;,
    disabled: &#039;opacity-50&#039;,
    md: &#039;px-6 py-3 text-lg&#039;,
    dark: &#039;bg-blue-900&#039;
  },
  {
    hover: {
      dark: &#039;bg-blue-800&#039;
    }
  }
])
Readable. Structured. Maintainable.You can instantly see which states contain which classes.🧩 Deep Nesting, Conditionals &amp; ArraysTailwind Tree supports complex UI logic:twTree([
  &#039;flex items-center gap-4&#039;,
  isActive ? &#039;bg-green-500&#039; : &#039;bg-gray-300&#039;,
  {
    hover: [
      &#039;opacity-80&#039;,
      isFocused ? &#039;shadow-lg&#039; : &#039;shadow-md&#039;,
      { dark: &#039;bg-gray-700&#039; }
    ],
    focus: {
      visible: &#039;ring-2 ring-green-500&#039;,
      dark: &#039;ring-green-300&#039;
    },
    md: [
      &#039;gap-6&#039;,
      { hover: &#039;scale-105&#039; }
    ]
  }
])
It compiles cleanly to the exact Tailwind classes your browser needs.🌀 Works With Tailwind v3 &amp; v4Tailwind Tree is version-agnostic.Tailwind v3Use the @tailwind-tree/extractor to parse twTree() and purge unused classes.Tailwind v4Use the @tailwind-tree/vite-plugin to inject safelisted classes during Vite’s build.Both require minimal configuration.💡 Why Tailwind Tree Improves Your Workflow✔ 1. ReadabilityClasses are grouped by meaning, not crammed together.✔ 2. MaintainabilityUpdating a hover, dark, md, or active class is simple — everything is in its logical place.✔ 3. Scales with complexityEven deeply nested states stay clean.✔ 4. Type safetyWith TypeScript, variant names autocomplete and type errors are surfaced.✔ 5. Zero performance costOnly used classes end up in production.🚀 Getting StartedInstallation:pnpm add tailwind-tree
# or
npm install tailwind-tree
# or
yarn add tailwind-treeUsage:import { twTree } from &#039;tailwind-tree&#039;;

className={twTree([
  &#039;base classes&#039;,
  {
    variant: &#039;classes&#039;,
    nested: { deeper: &#039;classes&#039; }
  }
])}
🌍 The Bigger PictureTailwind is incredible for utility-first styling.But as UIs grow, managing long class strings becomes a mental tax.Tailwind Tree bridges that gap by giving you:StructureNestingReadabilityMaintainabilityZero Tailwind frictionIt lets you express complex CSS logic without losing clarity.🔓 Open Source &amp; MIT-LicensedTailwind Tree is open source, free forever, and community-driven.GitHub: https://github.com/shervin-ghajar/tailwind-treenpm: https://www.npmjs.com/package/tailwind-treeContributions and feedback are welcome!🌳 Try It TodayIf you&#039;ve ever groaned at a 300-character Tailwind class string, give Tailwind Tree a try.It might change how you write Tailwind — forever.Made with 💙 by Shervin Ghajar</description>
                <category>Shervin Ghajar</category>
                <author>Shervin Ghajar</author>
                <pubDate>Mon, 08 Dec 2025 14:41:42 +0330</pubDate>
            </item>
            </channel>
</rss>