<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"><channel><title>نوشته های Shervin Ghajar</title><link>https://virgool.ir/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-11-10 22:13:56</pubDate><image><url>https://files.virgool.ir/upload/users/4448579/avatar/avatar.png</url><title>Shervin Ghajar</title><link>https://virgool.ir/@ssghajar.work</link></image><item><title>با کلاس‌های شلوغ Tailwind خداحافظی کن؛ با 🌲 Tailwind Tree آشنا شو</title><link>https://virgool.ir/@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=&#34;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 ...&#34; /&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=&#34;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&#34; /&gt;&#xA;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([&#xA;  &#39;px-4 py-2 bg-blue-500 text-white rounded&#39;,&#xA;  {&#xA;    hover: &#39;bg-blue-600&#39;,&#xA;    focus: &#39;ring-2 ring-blue-300&#39;,&#xA;    active: &#39;bg-blue-700&#39;,&#xA;    disabled: &#39;opacity-50&#39;,&#xA;    md: &#39;px-6 py-3 text-lg&#39;,&#xA;    dark: &#39;bg-blue-900&#39;&#xA;  },&#xA;  {&#xA;    hover: {&#xA;      dark: &#39;bg-blue-800&#39;&#xA;    }&#xA;  }&#xA;])&#xA;Readable. Structured. Maintainable.You can instantly see which states contain which classes.🧩 Deep Nesting, Conditionals &amp; ArraysTailwind Tree supports complex UI logic:twTree([&#xA;  &#39;flex items-center gap-4&#39;,&#xA;  isActive ? &#39;bg-green-500&#39; : &#39;bg-gray-300&#39;,&#xA;  {&#xA;    hover: [&#xA;      &#39;opacity-80&#39;,&#xA;      isFocused ? &#39;shadow-lg&#39; : &#39;shadow-md&#39;,&#xA;      { dark: &#39;bg-gray-700&#39; }&#xA;    ],&#xA;    focus: {&#xA;      visible: &#39;ring-2 ring-green-500&#39;,&#xA;      dark: &#39;ring-green-300&#39;&#xA;    },&#xA;    md: [&#xA;      &#39;gap-6&#39;,&#xA;      { hover: &#39;scale-105&#39; }&#xA;    ]&#xA;  }&#xA;])&#xA;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&#xA;# or&#xA;npm install tailwind-tree&#xA;# or&#xA;yarn add tailwind-treeUsage:import { twTree } from &#39;tailwind-tree&#39;;&#xA;&#xA;className={twTree([&#xA;  &#39;base classes&#39;,&#xA;  {&#xA;    variant: &#39;classes&#39;,&#xA;    nested: { deeper: &#39;classes&#39; }&#xA;  }&#xA;])}&#xA;🌍 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&#39;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 15:41:42 +0330</pubDate></item></channel></rss>