<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Marc Vilella on Medium]]></title>
        <description><![CDATA[Stories by Marc Vilella on Medium]]></description>
        <link>https://medium.com/@mvilella?source=rss-26c38904de3f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*BL8-gJbbR7ArMQO1kXexnA.jpeg</url>
            <title>Stories by Marc Vilella on Medium</title>
            <link>https://medium.com/@mvilella?source=rss-26c38904de3f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 27 Nov 2026 13:16:51 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mvilella/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Use the Right Amount of Framework: Lessons from petite-vue]]></title>
            <link>https://medium.com/@mvilella/use-the-right-amount-of-framework-lessons-from-petite-vue-be4d4c661e41?source=rss-26c38904de3f------2</link>
            <guid isPermaLink="false">https://medium.com/p/be4d4c661e41</guid>
            <category><![CDATA[petite-vue]]></category>
            <category><![CDATA[framework]]></category>
            <category><![CDATA[frontend]]></category>
            <category><![CDATA[vue]]></category>
            <dc:creator><![CDATA[Marc Vilella]]></dc:creator>
            <pubDate>Sat, 24 Oct 2026 20:55:27 GMT</pubDate>
            <atom:updated>2026-10-26T09:12:47.619Z</atom:updated>
            <content:encoded><![CDATA[<p>If you’ve ever reached for a full frontend framework for something that only needed a little interactivity, I’ve been there too. That’s how I discovered <a href="https://github.com/vuejs/petite-vue">petite-vue</a>, a 6kb alternative from the Vue ecosystem that brings Vue-like reactivity to existing HTML without requiring a build step or an entire frontend toolchain.</p><pre>&lt;div v-scope=&quot;{ count: 0 }&quot;&gt;<br>  &lt;button @click=&quot;count++&quot;&gt;<br>    Clicked {{ count }} times<br>  &lt;/button&gt;<br>&lt;/div&gt;<br><br>&lt;script src=&quot;https://unpkg.com/petite-vue&quot; defer init&gt;&lt;/script&gt;</pre><p>A CDN import, familiar directives, reactive data, event handlers. No Vite configuration, no node_modules, no build pipeline. Just the bits needed to make a page interactive.</p><blockquote>Wait, is that all I need? Nice!</blockquote><p>I was sold… temporarily.</p><h3>When small doesn’t mean simple</h3><p>My first experience with petite-vue was in a WordPress — don’t ask — plugin. I needed to build a multistep interface involving product selection, box management, API calls, and state changes between different parts of the UI. It wasn’t just a couple of buttons toggling visibility, the interface had some actual behavior to manage.</p><p>As the plugin grew, I started running into the limitations of petite-vue. I wanted better component reuse, more structured communication, and more control over state. I started reaching for primitives and workarounds, adding conditional rendering wherever it seemed convenient, and trying to reproduce patterns I was already familiar with from Vue.</p><p>The architecture wasn’t getting better. It was getting messier.</p><p>The interface had grown beyond what I was comfortable managing with petite-vue. I decided I needed something more capable and moved to Vue. I gained TypeScript, linter, testing… That was a perfectly reasonable decision. But nothing comes for free. I ended up with a complete Vue project, including its Node.js dependencies, build tooling, and configuration, living inside a PHP project.</p><blockquote>Because apparently, managing one ecosystem wasn’t enough.</blockquote><p>I started wondering whether I was paying for more machinery than this particular interface needed.</p><h3>Maybe I was asking the wrong question</h3><p>I decided to give petite-vue another shot, but this time with a different approach.</p><p>I’m no longer asking <strong><em>“How can I build this Vue application with petite-vue?”</em></strong> but <strong><em>“What can I build with petite-vue without turning it into a Vue application?”</em></strong>.</p><p>The distinction sounds small, but it changes how you approach the problem.</p><p>When you’re used to a full frontend framework, its abstractions become your default way of thinking. These are good tools. I’ve spent years using them, and I don’t want to give them up.</p><p>But when the framework doesn’t provide those abstractions, it’s tempting to recreate them yourself. You see a limitation and your first instinct is to work around it until you can keep doing things the way you’re used to.</p><p>That’s how you end up building a worse version of the thing you deliberately chose not to use.</p><p>I stopped treating every missing feature as a problem that needs to be solved. Sometimes you genuinely need the feature, other times you don’t. You may just need the underlying capability, but not the way you’re used to using it.</p><h3>Learning to work with the constraints</h3><p>One example was v-model. It&#39;s the Vue convention for synchronizing data with a component. It&#39;s familiar, expressive, and often exactly what you want. Petite-vue doesn&#39;t provide that same component-level abstraction, and I tried harder than I&#39;ll acknowledge to recreate it. I eventually accepted that I didn&#39;t need to. Mutating an object passed by reference to a component was a reasonable trade-off.</p><pre>const Selector = props =&gt; ({<br>  $template: &#39;#selector&#39;,<br>  options: props.options,<br>  <br>  /* Sharing state through a mutable prop */<br>  get selected() { return props.model.value; },<br>  select(option) {<br>    props.model.value = option;<br>    props.onSelect?.(props.model);<br>  },<br>});</pre><p>It&#39;s not the pattern I&#39;d normally choose, and it&#39;s considered an important code smell (which, to be fair, it is), but it solved the problem without introducing another layer of abstraction.</p><p>Similar experience with prop drilling. When I realized that petite-vue’s scope leaks to child components, I thought it would be the source of countless bugs and a debugging nightmare. Eventually, I realized I could use it as a lightweight version of provide/inject, I just had to come up with a clear naming convention for global attributes coming from the root to communicate the intent.</p><pre>&lt;!-- Component Template --&gt;<br>&lt;template id=&quot;admin-panel&quot;&gt;<br>  &lt;p&gt;Current Theme: {{ THEME }}&lt;/p&gt;<br>&lt;/template&gt;<br><br>&lt;!-- Root Scope --&gt;<br>&lt;div v-scope=&quot;{ THEME: &#39;dark&#39; }&quot; @vue:mounted=&quot;initApp&quot;&gt;<br>  &lt;!-- Child component inherits THEME from root scope --&gt;<br>  &lt;section v-scope=&quot;AdminPanel()&quot;&gt;&lt;/section&gt;<br>&lt;/div&gt;</pre><p>The same applies to component boundaries. I still want reusable pieces and understandable interfaces, but I’m no longer trying to turn every interactive element into a fully fledged component with an elaborate API. Sometimes a small object and a couple of methods are enough.</p><pre>const step = {<br>  current: 0,<br>  go(step) { this.current = clamp(step, 0, STEPS); },<br>  prev() { this.go(this.current - 1); },<br>  next() { this.go(this.current + 1); },<br>};</pre><p>When a framework leaves more decisions to you, you have to be deliberate about which conventions are worth keeping and which ones you’re carrying over out of habit.</p><h3>So, where does petite-vue fit?</h3><p>I consider petite-vue a useful tool between vanilla JavaScript and a full frontend framework.</p><p>Think of settings pages, administrative interfaces, small interactive widgets, or progressively enhanced pages in applications built with PHP, Rails, or Django. In these situations, a little reactivity can make a substantial difference to the user experience without building an entire application around it.</p><p>You can import petite-vue from a CDN and get something working almost immediately, using syntax that already feels familiar if you know Vue. No build setup, no extra tooling to configure.</p><p>Of course, there’s a limit. When you start needing routing, complex state management, or extensive component communication, petite-vue becomes less comfortable. If you find yourself constantly fighting the framework, it might be time to reach for something more capable.</p><p>In my case, that something would probably be Vue. No drama. I’m a Vue fanboy 😍.</p><p>The point isn’t that petite-vue should replace Vue, it’s that the two tools don’t need to solve the same problems.</p><h3>Knowing When Enough Is Enough</h3><p>I still think petite-vue is a great little piece of software. Its simplicity, familiar syntax, and almost nonexistent setup make it an excellent option for certain problems.</p><p>But I’ve changed how I evaluate it. I’m no longer asking how much of Vue it can reproduce, but how much it helps me accomplish without introducing complexity I don’t need.</p><p>We get used to certain ways of doing things because we use them every day. Eventually, we stop questioning whether we need them at all. Working with a smaller tool may challenge those habits and help you figure out what a project actually needs.</p><p>If you’ve never looked at petite-vue, it’s still worth knowing about. Even if you don’t use it, working with a smaller tool might help you recognize which things your next project actually needs.</p><blockquote><strong>UPDATE:</strong> petite-vue doesn’t appear to be actively maintained anymore, its latest release dates back around five years. But this isn’t really about petite-vue. It applies to other lightweight tools too, whether it’s petite-vue, Alpine.js, Preact, or something else, the lessons remain the same.</blockquote><p><strong>P.S.</strong> Ditching the build step often means leaving your test runner behind. That’s why I built <a href="https://github.com/markusand/testamenta">testamenta</a>, a tiny testing library that runs straight in the browser. If you’re working on projects without a setup, you might find it useful.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=be4d4c661e41" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Is Your Functional Pipeline Doing Too Much Work?]]></title>
            <link>https://medium.com/@mvilella/is-your-functional-pipeline-doing-too-much-work-f85159d56bd5?source=rss-26c38904de3f------2</link>
            <guid isPermaLink="false">https://medium.com/p/f85159d56bd5</guid>
            <category><![CDATA[arrays]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[iterators]]></category>
            <category><![CDATA[functional-programming]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Marc Vilella]]></dc:creator>
            <pubDate>Wed, 19 Aug 2026 15:29:15 GMT</pubDate>
            <atom:updated>2026-08-19T15:34:43.267Z</atom:updated>
            <content:encoded><![CDATA[<p>Functional programming has made code much easier to read. Instead of describing how to loop over a collection, we describe what we want to do with it.</p><pre>const result = items<br>    .filter(isValid)<br>    .map(transform)<br>    .find(matches);</pre><p>That’s clean, human-readable code. Filter the valid items, transform them, and find the first match.</p><p>There’s just one problem: Every array method is eager.</p><p>Composing several of them forces the engine to traverse the collection multiple times, allocate intermediate arrays, and compute work the final operation might never need.</p><p>The code looks like a single pipeline. The runtime executes three separate loops.</p><h3>The hidden cost of composition</h3><p>Take our example again. It looks like a single pipeline: filter some things out and transform the rest. But filter() has to finish before map() can start, and map() has to finish before find() can start.</p><p><strong>That’s three traversals and two intermediate array allocations.</strong></p><p>The more operations we compose, the more this matters.</p><p>The waste becomes clear when the last operation short-circuits. find() only needs a single matching element. But by the time it executes, the previous operations have already processed the entire dataset.</p><p>This is particularly wasteful when transform is expensive or the match is near the start.</p><blockquote><em>Imagine </em>filter() <em>checked 10.000 items, </em><em>map() transformed 5.000 of them, just for </em><em>find() to grab the 10th item and say: </em>“I found it. We’re done”<em>. You’ve just burned CPU cycles on 4,990 transformations that were instantly discarded.</em></blockquote><h3>What if the pipeline was actually lazy?</h3><p>Nothing in our logic requires evaluating the entire array up front, but that’s exactly what array methods require. Iterator helpers let us take it back.</p><p>The same code can be expressed as:</p><pre>const result = Iterator.from(items)<br>    .filter(isValid)<br>    .map(transform)<br>    .find(matches);</pre><p>The syntax is virtually identical, but the timing is completely different.</p><p>The iterator doesn’t process the whole collection when you call filter() or map(). Values are processed when something consumes the iterator, the pipeline advances one item at a time.</p><p>When find() gets a match, it stops asking for more values. Everything after that item is never processed. That’s a fundamentally different execution model.</p><p>The same benefit applies to short-circuiting operations like .some() or .every(). The computation halts the exact moment the answer is known.</p><h3>Eager is often fine</h3><p>Iterators aren’t a silver bullet. Every .next() call, iterator object, and abstraction layer introduces a baseline overhead. Replacing array methods with iterators doesn’t always pay off.</p><pre>const doubled = items.map(value =&gt; value * 2);</pre><p>This is simpler, eager, and exactly expresses what you need: transform every element and give me an array.</p><p>The question isn’t really: <em>Are iterators better than arrays?</em></p><p>It’s: <strong><em>Do I need to evaluate the entire pipeline right now?</em></strong></p><p>If the answer is yes, an array is often perfectly appropriate. If the answer is no, an iterator gives you a way to defer that decision.</p><h3>It’s not composition. It’s eagerness</h3><p>Functional array methods are great. map(), filter() or reduce() make code dramatically easier to write and understand.</p><p><strong>The problem isn’t functional composition. The problem is eager composition.</strong></p><p>Array methods force immediate evaluation, turning innocent-looking chains into multiple passes and allocations. And we don’t always need it.</p><p>Iterator helpers provide lazy evaluation without losing the expressive, declarative syntax. That’s a pretty good reason to keep iterators in the toolbox.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f85159d56bd5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How CSS Is Reclaiming UI Logic: A Tooltip Case Study]]></title>
            <link>https://medium.com/@mvilella/how-css-is-reclaiming-ui-logic-a-tooltip-case-study-d98de72d707f?source=rss-26c38904de3f------2</link>
            <guid isPermaLink="false">https://medium.com/p/d98de72d707f</guid>
            <category><![CDATA[css]]></category>
            <category><![CDATA[tooltips]]></category>
            <dc:creator><![CDATA[Marc Vilella]]></dc:creator>
            <pubDate>Fri, 17 Jul 2026 18:05:54 GMT</pubDate>
            <atom:updated>2026-07-17T18:05:54.322Z</atom:updated>
            <content:encoded><![CDATA[<p>For years, we’ve treated interactive UI as JavaScript’s responsibility. Tooltips, dropdowns, popovers, modals… they all required JavaScript for positioning, reacting to scrolling and resizing, collision detection, and even animations.</p><p>None of that is business logic. Your application code shouldn’t care where UI elements should appear, how they should reposition when the user scrolls, or how their transition is implemented. We’ve been delegating those responsibilities to JavaScript simply because it was the only part of the platform capable of handling them.</p><p>That is finally changing.</p><p>Modern HTML and CSS are gaining features that let the browser take responsibility for UI concerns. The Popover API, anchor positioning, container queries, discrete transitions, color functions, and even CSS conditionals all contribute to a platform that&#39;s capable of building rich UI components with little to no JavaScript.</p><h3>The tooltip case study</h3><p>A tooltip looks like one of the simplest UI components: a trigger element and some hidden content that shows up on click.</p><p>But the moment we move beyond the happy path, things become surprisingly complex. Where should the tooltip appear, above or below the trigger? What happens when there isn’t enough space in the viewport? Should it follow the trigger when the page scrolls? What about resizing the browser window? And don’t forget the animation. A good tooltip shouldn’t just pop in and out, it needs to smoothly enter and leave the page.</p><p>For years, solving all of these problems meant combining custom JavaScript with some smart tricks we’ve been learning through the journey. Now we can start relying on native platform features to handle all of it.</p><blockquote><strong><em>Warning. </em></strong>As usual with cutting-edge web features, browser support is still a moving target. While Chromium browsers currently lead the charge in supporting the full suite of these APIs, you’ll want to check CanIUse before dropping this into production today.</blockquote><h4>The Popover API: visibility without JavaScript</h4><p>A tooltip is not just a div that happens to be hidden or visible, it is a piece of UI with specific semantics and behavior. Is the tooltip open? Should it close when clicking outside? Should it handle escape key presses?</p><p>With the Popover API, we can declare it directly in HTML</p><pre>&lt;button popovertarget=&quot;tooltip&quot;&gt;Show&lt;/button&gt;<br>&lt;div id=&quot;tooltip&quot; popover&gt;<br>  Tooltip content<br>&lt;/div&gt;</pre><p>With this alone, the browser handles all the interaction. No state variable. No event listener. No custom logic.</p><p>Why not just wrap the trigger and the tooltip in a div and use :hover or :focus-within? Legit question. This is one of the tricks we’ve been doing for a long time, and it’s still a perfectly valid solution. The Popover API gives the browser a semantic knowledge about what this UI represents, that this is an element that can be opened and closed, that it can be dismissed with Escape, that it participates in the top layer, and that it should be managed independently from the document layout.</p><h4>Anchor Positioning: stop measuring elements</h4><p>Once the tooltip can be shown, the next question is obvious: where should it appear? Anchor Positioning removes the entire JavaScript logic responsible for calculating and updating tooltip placement.</p><pre>.trigger {<br>  anchor-name: --trigger;<br>}<br><br>.tooltip {<br>  --position: top;<br><br>  position-anchor: --trigger;<br>  position-area: var(--position);<br>}</pre><p>That’s it! If the page scrolls, the layout changes, or the trigger moves for any reason, the tooltip follows automatically.</p><p>No getBoundingClientRect(). No ResizeObserver. No scroll listeners.</p><p>Just a relationship between two elements that the browser already understands.</p><p>Now that the tooltip is correctly positioned, there is still another element involved: the arrow. A common way to create tooltip arrows is with a pseudo-element.</p><pre>.tooltip {<br>  --color: #333;<br><br>  position: relative;<br>  background: var(--color);<br>  color: contrast-color(var(--color));<br><br>  &amp;::before {<br>    content: &quot;&quot;;<br>    display: block;<br>    border: 0.25rem solid transparent;<br>    border-top-color: var(--color);<br><br>    /* position */<br>    position: absolute;<br>    top: calc(100% + 0.25rem);<br>    left: 50%;<br>  }<br>}</pre><p>This works well when the tooltip (and the arrow) is centered relative to its trigger. But that is not always guaranteed. We can deliberately position the tooltip at the start edge of the trigger, resulting in an arrow no longer pointing at it. The solution is simple: anchor the arrow to the trigger as well.</p><pre>.tooltip {<br>  &amp;::before {<br>    /* position */<br>    position: fixed;<br>    position-anchor: --trigger;<br>    position-area: var(--position);<br>  }<br>}</pre><p>The arrow is now positioned relative to the same anchor as the tooltip. The browser keeps both elements connected to the trigger, even when the tooltip is offset or repositioned.</p><p>We solved the relationship between the tooltip, the arrow, and the trigger. But we still have one unresolved problem: what happens when the preferred position doesn’t fit?</p><h4>Position Fallbacks: let the browser decide</h4><p>Of course, placing every tooltip above its trigger only works until the trigger reaches the top of the viewport.</p><p>Historically, this meant more JavaScript. We would detect whether the preferred position fit, calculate the available space, and choose another placement when necessary.</p><p>Anchor Positioning doesn’t stop at attaching one element to another. It also lets us declare fallback strategies.</p><pre>.tooltip {<br>  position-area: var(--position);<br>  position-try-fallbacks: flip-block, flip-inline, flip-block flip-inline;<br>}</pre><p>The browser tries to place the tooltip in the preferred position. If that isn’t possible, it follows the fallback strategy.</p><p>An entire collision detection algorithm, replaced by one single line.</p><h4>Container Queries: CSS reacting to layout decisions</h4><p>The tooltip is now correctly positioned, and the browser knows how to move it when there is not enough space. But the arrow still has a problem. We need to know where the tooltip has moved to reposition the arrow accordingly. We can use style queries and anchored queries.</p><pre>.tooltip {<br>  container-type: anchored;<br><br>  &amp;::before {<br>    @container style(--position: top) {<br>      border-top-color: var(--color);<br><br>      @container anchored(fallback: flip-block) {<br>        position-area: bottom;<br>        border-color: transparent;<br>        border-bottom-color: var(--color);<br>      }<br>    }<br>  }<br>}</pre><p>The first query says <em>“The tooltip was intended to be on top.”. </em>The second says <em>“The browser had to flip it to the bottom.”</em></p><p>Together, they allow CSS to keep the arrow synchronized with the final layout without any JavaScript coordination. The browser makes the positioning decision and adapts the component.</p><h4>Discrete Transitions: animating what used to be impossible</h4><p>The tooltip is now positioned, adapts to available space, and its arrow follows every reposition made by the browser.</p><p>The last piece is making it feel good.</p><p>Historically, transition between the two states of an element was a problem because properties like display cannot be animated. The usual workaround was to combine multiple properties:</p><pre>.tooltip {<br>  opacity: 0;<br>  visibility: hidden;<br>  transition: opacity 0.2s ease;<br><br>  &amp;.open {<br>    opacity: 1;<br>    visibility: visible;<br>  }<br>}</pre><p>Or even worse, involve JavaScript to coordinate adding and removing classes after animations finished.</p><p>Modern CSS introduces discrete transitions and a new primitive @starting-style, where properties that until now could only switch instantly can now participate in transitions.</p><pre>body {<br>  transition-behavior: allow-discrete;<br>}<br><br>.tooltip {<br>  --timing: 0.2s;<br><br>  opacity: 0;<br>  margin: 0;<br>  transition:<br>    opacity var(--timing) ease,<br>    margin var(--timing) ease,<br>    display var(--timing) allow-discrete,<br>    overlay var(--timing) allow-discrete;<br><br>  &amp;:popover-open {<br>    display: block;<br>    opacity: 1;<br>    margin: 0.5rem;<br><br>    @starting-style {<br>      opacity: 0;<br>      margin: 0;<br>    }<br>  }<br>}</pre><p>Together, discrete transitions and @starting-style let the browser coordinate the complete lifecycle of the tooltip: inserting it, animating it, and removing it.</p><p>No timers. No animation callbacks. No manually delaying DOM changes.</p><h4>Putting it all together</h4><p>We’ve looked at each piece in isolation, but the interesting part is how they work together.</p><p>The final tooltip combines all these platform capabilities:</p><ul><li>The Popover API manages its visibility and lifecycle.</li><li>Anchor Positioning keeps the tooltip and arrow connected to the trigger.</li><li>Position Fallbacks handle collision detection.</li><li>Style Queries and Anchored Container Queries keep the arrow synchronized with the final layout.</li><li>Discrete Transitions and @starting-style handle the animation.</li></ul><p>The result is a tooltip with no positioning logic, no resize listeners, no scroll handlers, and no JavaScript coordination.</p><p>You can see a complete implementation here:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fmarkusand%2Fembed%2Fpreview%2FNPdXYey%3Fdefault-tabs%3Dcss%252Cresult%26height%3D600%26host%3Dhttps%253A%252F%252Fcodepen.io%26slug-hash%3DNPdXYey&amp;display_name=CodePen&amp;url=https%3A%2F%2Fcodepen.io%2Fmarkusand%2Fpen%2FNPdXYey&amp;image=https%3A%2F%2Fshots.codepen.io%2Fusername%2Fpen%2FNPdXYey-512.jpg%3Fversion%3D1783431203&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/cb2734df5f9b73a315977bb882ea4319/href">https://medium.com/media/cb2734df5f9b73a315977bb882ea4319/href</a></iframe><p>A few years ago, building this component required JavaScript for almost every part. Today, the browser can handle these responsibilities directly.</p><p>This tooltip is just a small example, but the implications are much bigger.</p><p>The interesting part is not that CSS can save us a few lines of code. The interesting part is that the browser is finally exposing primitives for problems that were always browser problems.</p><p>CSS is not replacing JavaScript. JavaScript is still the right tool for application logic. CSS is reclaiming UI logic that never belonged there in the first place.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d98de72d707f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stop Using SSH in Hard Mode: 4 Tiny Tweaks for the Rest of Us]]></title>
            <link>https://medium.com/@mvilella/stop-using-ssh-in-hard-mode-4-tiny-tweaks-for-the-rest-of-us-b527a87df298?source=rss-26c38904de3f------2</link>
            <guid isPermaLink="false">https://medium.com/p/b527a87df298</guid>
            <category><![CDATA[ssh]]></category>
            <category><![CDATA[dx]]></category>
            <category><![CDATA[terminal]]></category>
            <category><![CDATA[ssh-keys]]></category>
            <category><![CDATA[tmux]]></category>
            <dc:creator><![CDATA[Marc Vilella]]></dc:creator>
            <pubDate>Sat, 09 May 2026 22:10:36 GMT</pubDate>
            <atom:updated>2026-05-09T22:10:36.882Z</atom:updated>
            <content:encoded><![CDATA[<p>I’m a frontend developer, not a backend engineer or a systems administrator.</p><p>Most of my SSH usage over the years has been extremely simple: connect to a Raspberry Pi, deploy a Docker container, restart a service, and leave.</p><p>Usually it looked something like this:</p><pre>ssh marc@192.168.1.30 -p 2222</pre><p>Then type the password. Again. And again. And again.</p><p>For a long time, that was just “using SSH”. But after working alongside backend and systems people for a while, I started picking up small tricks that made remote development dramatically less annoying. Nothing advanced. Just tiny quality-of-life improvements that compound surprisingly fast.</p><h3>You still use credentials?</h3><p>The first revelation came when a colleague asked why was I still typing a server password for the fifth time that day. To be honest, I never even bothered thinking about it. That was the moment I realized I was accidentally using SSH in hard mode.</p><p>It takes literally 10 seconds to set your own key and copy it to the server.</p><pre>ssh-keygen -t ed25519<br>ssh-copy-id marc@192.168.1.30</pre><p>That sounds like a small thing, but suddenly the whole interaction changes. You stop thinking about authentication completely, you connect more often, experiment more, automate more things. SSH becomes instant.</p><h3>Goodbye, random IP addresses</h3><p>My terminal history was basically a graveyard of IP addresses and ports I could never remember. Then I learned you can simply define hosts in a .ssh/config file.</p><pre>Host magicmirror<br>  HostName 192.168.1.30<br>  User marc<br>  Port 22<br>  IdentityFile ~/.ssh/id_ed25519</pre><p>That’s it. It sounds almost too simple to matter, but this was probably the SSH improvement that had the biggest day-to-day impact for me.</p><p>Now the command becomes:</p><pre>ssh magicmirror</pre><p>And I’m already in. No IPs, no credentials. Just 2 words.</p><h3>Separating work from chaos</h3><p>After a while, my SSH config started growing. Personal Raspberry Pis, side projects, work servers, staging environments. Predictably, it became messy. So I stole another trick: splitting the config into multiple files.</p><p>Now my main SSH config looks like this:</p><pre>Include ~/.orbstack/ssh/config<br>Include ~/.ssh/personal/*.conf<br>Include ~/.ssh/work/*.conf</pre><p>Tiny change, huge mental relief.</p><p>I can isolate work and personal infrastructure, use different identities, and keep everything easier to find and understand.</p><p>Once I had my connections organized, I had to deal with the next frustration: the connection dropping.</p><h3>Keeping sessions alive</h3><p>I avoided tmux for years because it looked like one of those tools a Russian hacker use to break into NSA servers from a ThinkPad running Arch Linux.</p><p>Turns out, it just solves an incredibly common problem. We’ve all been there: you’re halfway through a long system update and your friends are already at the bar waiting for you, but you can’t just close the terminal. You’re essentially a hostage to a progress bar.</p><p>Instead of just running your command, you type tmux first. If your Wi-Fi cuts out or you accidentally close your laptop, you don’t lose your progress. When you log back in via SSH, you just type tmux attach and your terminal looks exactly like it did before.</p><p>Once I realized how useful tmux was, I just made it automatic by adding a couple of lines to my config and the server now ‘remembers’ exactly where I was the moment I connect.</p><pre>Host magicmirror<br>  ...<br>  RemoteCommand tmux new -A -s default<br>  RequestTTY yes </pre><p>I won’t go deeper than this. There’s already a lot of great content out there from people far more experienced than me. But learning just enough to start and reattach sessions is absolutely worth it if you spend time inside remote machines.</p><p>I still use SSH in a very lightweight way compared to actual infrastructure engineers. Mainly for side projects and random homelab experiments.</p><p>Ironically, these small SSH improvements also expanded my scope a bit at work. Mostly lightweight fullstack services deployed on a cheap VPS, enough to make infrastructure feel much less foreign.</p><p>And that’s probably the biggest thing I learned: you don’t need deep infrastructure knowledge to benefit from better tooling habits. Sometimes a few small improvements are enough to completely change the experience.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b527a87df298" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Beyond Query Methods with the Criteria Pattern]]></title>
            <link>https://medium.com/@mvilella/beyond-query-methods-with-the-criteria-pattern-a4cd8d22dc41?source=rss-26c38904de3f------2</link>
            <guid isPermaLink="false">https://medium.com/p/a4cd8d22dc41</guid>
            <category><![CDATA[design-patterns]]></category>
            <category><![CDATA[refactoring]]></category>
            <category><![CDATA[clean-architecture]]></category>
            <dc:creator><![CDATA[Marc Vilella]]></dc:creator>
            <pubDate>Sat, 18 Apr 2026 22:38:37 GMT</pubDate>
            <atom:updated>2026-04-18T22:38:37.460Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Beyond Repository’s Query Methods with the Criteria Pattern</strong></h3><p>You are writing a repository. It starts simple, one method, maybe two. Looks clean.</p><pre>class UserRepository:<br>    def get_all(self) -&gt; List[User]:<br>        #...<br>  <br>    def get_by_id(self, user_id: str) -&gt; List[User]:<br>        # ...</pre><p>Then a new requirement lands. “<em>Find only active users whose email is from a specific domain</em>”. So you add a new methodget_active_by_email().</p><p>A week later: “filter by role”, “exclude suspended”, “created after 2024”, …</p><p>Suddenly you’re not writing queries anymore, you’re dealing with method explosion. The idea that repositories should expose one method per use case feels explicit, but <strong>scales terribly</strong>.</p><p>In a moment of lucidity, you make it dynamic. Pass a callback. Let the caller decide.</p><pre>self._repo.get_by(lambda q: q.where(&quot;email&quot;, email).where(&quot;is_active&quot;, True))</pre><p>Your service now speaks fluent ORM. Those filters are written against your specific database engine, leaking through layer boundaries. Swap the database and you’ll have to touch every service.</p><p>You just broke the primary dependency rule in clean(-ish) architecture. <strong>Inner layers should not depend on outer layers</strong>. To be honest, if you arrived at this point, you probably already have your domain layer fully coupled to your database.</p><p>At some point you may have another <em>Aha!</em> moment. Dict-based filters.</p><pre>repo.find({ &quot;email&quot;: email, &quot;is_active&quot;: True })</pre><p>Super convenient… until someone needs OR conditions, negation, partial matches, or anything beyond simple equality.</p><p>A plain dictionary has no semantics. Where is intention defined? Nowhere. It’s just assumed.</p><p>When requirements evolve, the dict starts growing vocabulary.</p><pre>{<br>  &quot;$and&quot;: [<br>    {&quot;$or&quot;: [{&quot;role&quot;: &quot;admin&quot;}, {&quot;role&quot;: &quot;user&quot;}]},<br>    {&quot;$neq&quot;: {&quot;status&quot;: &quot;suspended&quot;}}<br>  ]<br>}</pre><p>Congratulations! You spent a week reinventing a worse, buggier version of SQL. This is how accidental DSLs are born.</p><h3>Introducing the Criteria Pattern</h3><p>At its core, the Criteria pattern makes data filtering a first-class object. It maintains your services agnostic of the underlying persistence layer, and allows to add new filters by extending the Criteria structure without ever needing to change the repository’s public interface.</p><pre># shared/criteria.py<br><br>from typing import Any, Tuple<br>from dataclasses import dataclass<br>from enum import StrEnum<br><br>class Op(StrEnum):<br>    EQUALS = &quot;EQUALS&quot;<br>    IN = &quot;IN&quot;<br>    CONTAINS = &quot;CONTAINS&quot;<br>    AND = &quot;AND&quot;<br>    OR = &quot;OR&quot;<br>    NOT = &quot;NOT&quot;<br><br>@dataclass(frozen=True)<br>class Criteria:<br>    op: Op<br>    field: str | None<br>    value: Any<br><br>    @classmethod<br>    def EQUALS(cls, field: str, value: Any) -&gt; &quot;Criteria&quot;:<br>        return cls(field=field, op=Op.EQUALS, value=value)<br><br>    @classmethod<br>    def IN(cls, field: str, options: Tuple[Any, ...]) -&gt; &quot;Criteria&quot;:<br>        return cls(field=field, op=Op.IN, value=options)<br><br>    @classmethod<br>    def CONTAINS(cls, field: str, value: Any) -&gt; &quot;Criteria&quot;:<br>        return cls(field=field, op=Op.CONTAINS, value=value)<br><br>    @classmethod<br>    def AND(cls, first: &quot;Criteria&quot;, second: &quot;Criteria&quot;, *rest: &quot;Criteria&quot;) -&gt; &quot;Criteria&quot;:<br>        return cls(field=None, op=Op.AND, value=(first, second, *rest))<br>    <br>    @classmethod<br>    def OR(cls, first: &quot;Criteria&quot;, second: &quot;Criteria&quot;, *rest: &quot;Criteria&quot;) -&gt; &quot;Criteria&quot;:<br>        return cls(field=None, op=Op.OR, value=(first, second, *rest))<br>    <br>    @classmethod<br>    def NOT(cls, criteria: &quot;Criteria&quot;) -&gt; &quot;Criteria&quot;:<br>        return cls(field=None, op=Op.NOT, value=criteria)</pre><p>The repository contract stops growing and becomes predictable.</p><pre>class UserRepository(Protocol):<br>    def get_all(self) -&gt; List[User]: ...<br>    def get_by(self, criteria: Criteria) -&gt; List[User]: ...</pre><p>Criteria forces explicit meaning.<strong> </strong>It has no evaluation logic, it doesn’t know about SQL, and it doesn’t care about your ORM. The service expresses intent, the repository deals with execution.</p><blockquote>This is what I want. You figure out how.</blockquote><pre><br># Find user by id<br>by_id = Criteria.EQUALS(field=&quot;id&quot;, value=user_id)<br>users = self._repo.get_by(by_id)<br><br># Find users by role<br>by_role = Criteria.IN(field=&quot;role&quot;, options=(UserRole.ADMIN, UserRole.OWNER))<br>users = self._repo.get_by(by_role)<br><br># Find active users with domain email<br>by_active_email = Criteria.AND(<br>    Criteria.EQUALS(field=&quot;is_active&quot;, value=True),<br>    Criteria.CONTAINS(field=&quot;email&quot;, value=email_domain)<br>)<br>users = self._repo.get_by(by_active_email)</pre><p>The repository owns the translation from domain intent to data access reality. The database (or your ORM of choice) stays an implementation detail.</p><p>Here’s what that looks like with SQLModel:</p><pre>from sqlmodel import SQLModel, select, col, and_, or_, not_<br>from api.shared.criteria import Criteria, Op<br><br>def parse_criteria(criteria: Criteria, target: type[SQLModel]):<br>    match criteria.op:<br>        case Op.AND:<br>            return and_(*[parse_criteria(c, target) for c in criteria.value])<br>        case Op.OR:<br>            return or_(*[parse_criteria(c, target) for c in criteria.value])<br>        case Op.NOT:<br>            return not_(parse_criteria(criteria.value, target))<br>        case Op.EQUALS if criteria.field:<br>            return getattr(target, criteria.field) == criteria.value<br>        case Op.IN if criteria.field:<br>            return col(getattr(target, criteria.field)).in_(criteria.value)<br>        case Op.CONTAINS if criteria.field:<br>            return col(getattr(target, criteria.field)).contains(criteria.value)<br>        case _:<br>            raise ValueError(f&quot;Operator {criteria.op} not supported&quot;)</pre><pre>from .utils import parse_criteria<br> <br>class UserRepositorySQL:<br>    def get_by(self, criteria: Criteria) -&gt; List[User]:<br>        where = parse_criteria(criteria, UserSQL)<br>        query = select(UserSQL).where(where)<br>        users = self._session.exec(query).all()<br>        return [map_user(user) for user in users]</pre><p>Now you can swap SQLModel for Mongo, Redis, an in-memory store, or a test fake. Repository changes, nothing else does.</p><p>Moving toward a Criteria-based approach requires a bit more boilerplate upfront, but it pays off as the project grows. This little implementation is a starting point that gets the job done without overthinking it. Simple, extensible, and easy to reason about.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a4cd8d22dc41" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[You (probably) don’t need CSS preprocessors]]></title>
            <link>https://medium.com/@mvilella/you-probably-dont-need-css-preprocessors-03d084e0026b?source=rss-26c38904de3f------2</link>
            <guid isPermaLink="false">https://medium.com/p/03d084e0026b</guid>
            <category><![CDATA[css]]></category>
            <category><![CDATA[less]]></category>
            <category><![CDATA[stylus]]></category>
            <category><![CDATA[sass]]></category>
            <category><![CDATA[css-preprocessors]]></category>
            <dc:creator><![CDATA[Marc Vilella]]></dc:creator>
            <pubDate>Fri, 13 Mar 2026 18:35:07 GMT</pubDate>
            <atom:updated>2026-03-14T10:52:10.095Z</atom:updated>
            <content:encoded><![CDATA[<p>A decade ago, CSS was painfully limited. CSS preprocessors filled that gap and quickly became part of the stack. They didn’t try to replace CSS, they tried to <strong>fix it. </strong>And to be fair, they solved real problems.</p><p>But something changed. The language evolved. Today, most of the features that once made preprocessors indispensable exist natively in CSS.</p><p>Over the last years I found myself reaching for preprocessors less and less. Eventually I stopped using them entirely. Not because they suddenly became bad, but because the reasons that justified them largely disappeared.</p><h3>What we were missing, and what CSS took back</h3><p>Many patterns we take for granted today started with preprocessors. They taught us to think differently about structure, reuse, and abstraction.</p><h4><strong>Variables</strong></h4><p>Instead of repeating values everywhere, you defined variables once and reused them. Change the variable, update the entire UI. That alone justified the tool.</p><pre>$color-primary: #3498db;<br>$spacing-s: 0.5rem;<br>$spacing-m: 1rem;<br><br>.button {<br>  background: $color-primary;<br>  padding: $spacing-xs $spacing-m;<br>}</pre><p>Native CSS custom properties do the same thing… and more. They&#39;re scoped, they cascade, they can be updated at runtime with JavaScript, and they work inside calc(). --primary: #3498db is strictly more powerful than any variable.</p><pre>:root {<br>  --color-primary: #3498db;<br>  --spacing-s: 0.5rem;<br>  --spacing-m: 1rem;<br>}<br><br>.button {<br>  background: var(--color-primary, #333);<br>  padding: var(--spacing-s) var(--spacing-m);<br>}</pre><h4>Nesting</h4><p>Writing styles hierarchically without repeating selectors felt clean and readable. It was elegant. CSS now has native nesting, shipping in all major browsers since late 2023. The syntax is nearly identical. No compilation step required.</p><pre>.card {<br>  &amp; .title { ... }<br>}</pre><p>Native nesting isn’t a perfect drop-in replacement. It doesn’t support inverted selectors like :checked &amp; { ... } or BEM-style class generation with &amp;__element and &amp;--modifier. That’s fine though, BEM is largely unnecessary with component-scoped styles and modern naming conventions.</p><h4><strong>Color manipulation</strong></h4><p>Preprocessors had a full color toolbox that made it easy to derive color variations from a single base value. This was incredibly convenient when building design systems from a small palette.</p><pre>$color-primary: #3498db;<br>$color-primary--lighter: lighten($color-primary, 10%);<br>$color-primary--lightest: lighten($color-primary, 20%);<br>$color-primary--darker: darken($color-primary, 10%);<br>$color-primary--darkest: darken($color-primary, 20%);</pre><p>Native CSS now has color-mix(), oklch(), and the color() function with relative color syntax. The new color is computed at runtime, so changing a single variable automatically updates all related colors without rebuilding the CSS.</p><pre>:root {<br>  --color-primary: #3498db;<br><br>  --color-primary--lighter: color-mix(in srgb, var(--color-primary), white 20%);<br>  --color-primary--lightest: color-mix(in srgb, var(--color-primary), white 40%);<br>  --color-primary--darker: color-mix(in srgb, var(--color-primary), black 20%);<br>  --color-primary--darkest: color-mix(in srgb, var(--color-primary), black 40%);<br>}<br><br>@media (prefers-color-scheme: dark) {<br>  :root {<br>    --color-primary: #5dade2;<br>  }<br>}</pre><h4>Math calculations</h4><p>At the time, the only way to calculate values was with preprocessors.</p><pre>$space: 0.25rem;<br><br>.card { padding: 4 * $space }<br>.section { padding: 8 * $space }</pre><p>Native CSS now covers most of it. calc() handles arithmetic across mixed units. min(), max(), and clamp() handle responsive constraints in a single expression.</p><pre>:root { --space: 0.25rem; }<br><br>.card { padding: calc(4 * var(--space)) }<br>.section { padding: calc(8 * var(--space)) }</pre><p>The native version is nearly identical in verbosity, but computations are, again, live. Change the --space value in a media query or JavaScript, and every derived value updates instantly.</p><h4>Mixins</h4><p>This one took longest to replace cleanly. Mixins let you define reusable chunks of declarations and call them with optional arguments. The classic use cases were vendor prefixes, clearfix hacks, and responsive breakpoints.</p><pre>@mixin respond-to($breakpoint) {<br>  @if $breakpoint == &#39;md&#39; {<br>    @media (min-width: 768px) { @content; }<br>  } @else if $breakpoint == &#39;lg&#39; {<br>    @media (min-width: 1024px) { @content; }<br>  }<br>}<br><br>.card {<br>  font-size: 1rem;<br>  @include respond-to(&#39;md&#39;) { font-size: 1.25rem; }<br>}</pre><p>Most of that work has evaporated. Vendor prefixes are largely gone. Clearfix is irrelevant since flexbox and grid. Breakpoint mixins were solving a verbosity problem that clamp() and fluid design patterns now sidestep entirely.</p><pre>.card {<br>  font-size: clamp(1rem, 1.5vw, 1.25rem);<br>}</pre><p>And CSS keeps evolving. New native features are still on the way — things like :has() or conditionals — which are pushing even more capabilities directly into the language.</p><h3><em>Back to the platform</em></h3><p>Preprocessors didn’t fail, they became obsolete because they succeeded. They highlighted what CSS was missing, and the platform eventually adopted those ideas. Many of the concepts popularized by preprocessors directly shaped the evolution of CSS itself.</p><p>CSS hasn’t absorbed everything, and some edge cases still exist where a preprocessor earns its place. But those cases got rare enough that the extra dependency stopped being worth it.</p><p>For most projects, relying on the platform itself and following standards makes absolute sense. No extra compilation, no indirection, just the language as it was meant to be used.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=03d084e0026b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tailwind is an antipattern]]></title>
            <link>https://medium.com/@mvilella/tailwind-is-an-antipattern-4470d05d7d8a?source=rss-26c38904de3f------2</link>
            <guid isPermaLink="false">https://medium.com/p/4470d05d7d8a</guid>
            <category><![CDATA[tailwind]]></category>
            <category><![CDATA[frontend]]></category>
            <category><![CDATA[antipattern]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[styling]]></category>
            <dc:creator><![CDATA[Marc Vilella]]></dc:creator>
            <pubDate>Mon, 09 Mar 2026 19:12:16 GMT</pubDate>
            <atom:updated>2026-04-22T18:56:34.707Z</atom:updated>
            <content:encoded><![CDATA[<p>Every few years, the frontend ecosystem convinces itself that the solution to a hard problem is to stop doing the hard thing.</p><p>CSS naming is hard, so we stopped naming things. We replaced .card--elevated with shadow-md. We replaced .button--primary with bg-blue-600 text-white rounded-lg px-4 py-2 font-medium hover:bg-blue-700. We called it a productivity win and put it in every new project.</p><p>The hard thing wasn’t naming. The hard thing was <em>thinking about design systematically</em>. Tailwind didn’t solve that, it buried it under fourteen classes per element.</p><h3>It’s just inline styles with extra steps</h3><p>Well… actually it’s inline styles with <em>more</em> steps and a full build pipeline you now have to maintain.</p><p>Let’s be precise about what Tailwind utility classes actually are. flex is display: flex. p-6 is padding: 1.5rem. bg-white is background-color: #fff. rounded-xl is border-radius: 0.75rem.</p><p>That’s it. That’s the whole thing.</p><p>You’re not writing CSS. You’re writing CSS properties translated through a lookup table, scattered inline across your markup. You’ve traded the separation of concerns that the web platform was explicitly designed around — structure in HTML, presentation in CSS — for a system that puts <em>both</em> in HTML and calls it productivity.</p><p>We spent years learning why inline styles were bad. style=&quot;color: red; font-size: 14px;&quot; was an antipattern in 2005. Tailwind is that, with a nicer vocabulary and a PostCSS plugin.</p><h3>The architecture problem nobody wants to talk about</h3><p>There’s a reason CSS was invented as a separate layer. It’s not historical accident. It’s a deliberate architectural decision rooted in a simple principle: <strong>changes to presentation shouldn’t require changes to structure</strong>, and vice versa.</p><p>Tailwind obliterates this.</p><p>Want to change the padding on every card in your app? In CSS, you update .card { padding: ... }. One line. Done. In Tailwind? You grep for p-4 and hope you catch every instance. Or you go file by file.</p><p>Or, and this is where it gets ironic, you use @apply.</p><pre>/* The Tailwind way, apparently */<br>.card {<br>  @apply p-4 rounded-xl bg-white shadow-md;<br>}</pre><p>Wait! Hold on.</p><p>You just wrote… a class. With a name. That groups related styles together. Applied to HTML elements semantically.</p><p>That’s not Tailwind, that’s CSS. You’ve just made Tailwind a very complicated preprocessor for writing normal CSS, while also shipping a large stylesheet to your users and adding PostCSS to your build chain.</p><p>The framework’s own escape hatch is an admission that the framework doesn’t work.</p><h3>Design tokens done right, natively</h3><p>This is the part worth slowing down on, because it’s where the argument for Tailwind is strongest, and where the native platform case is most underappreciated.</p><p>Design tokens are the single source of truth for your design decisions. Spacing, color, typography, elevation, radius, the constraint system that makes a product feel coherent instead of arbitrary. Tailwind gives you this via its config and class vocabulary, but CSS’ custom properties give you the same thing, natively, with more power.</p><pre>/* tokens.css */<br><br>:root {<br>  /* Spacing */<br>  --spacing-xs: 0.25rem;<br>  --spacing-s: 0.5rem;<br>  --spacing-md: 1rem;<br>  --spacing-l: 1.5rem;<br>  --spacing-xl: 2rem;<br><br>  /* Color primitives */<br>  --color-blue-600: #2563eb;<br>  --color-blue-700: #1d4ed8;<br>  --color-gray-900: #111827;<br>  --color-white: #fff;<br><br>  /* Semantic tokens — this is where it gets powerful */<br>  --color-primary: var(--color-blue-600);<br>  --color-primary-hover: var(--color-blue-700);<br>  --color-surface: var(--color-white);<br>  --color-text: var(--color-gray-900);<br><br>  /* Component tokens */<br>  --button-padding-x: var(--spacing-s);<br>  --button-padding-y: var(--spacing-xs);<br>  --button-radius: 0.5rem;<br>}</pre><p>Now your component:</p><pre>.button-primary {<br>  padding: var(--button-padding-y) var(--button-padding-x);<br>  background-color: var(--color-primary);<br>  color: var(--color-surface);<br>  border-radius: var(--button-radius);<br>  font-weight: 500;<br>  transition: background-color 200ms ease;<br>}<br><br>.button-primary:hover {<br>  background-color: var(--color-primary-hover);<br>}</pre><p>Compare that to the Tailwind equivalent</p><pre>&lt;button className=&quot;px-4 py-2 bg-blue-600 text-white rounded-lg font-medium hover:bg-blue-700 transition-colors duration-200&quot;&gt;</pre><p>The Tailwind version hardcodes blue-600 directly on the element. If your brand color changes from blue to indigo, you grep-and-replace across hundreds of files. With semantic tokens, you update --color-primary once, in one file, and every component on the entire platform updates immediately.</p><p>That’s the difference between a one-line change and a two-hour migration.</p><p>And it gets better. Custom properties are <em>inherited</em>. They respond to context.</p><pre>/* Light mode — default */<br>:root {<br>  --color-primary: #2563eb;<br>  --color-surface: #fff;<br>  --color-text: #111827;<br>}<br><br>/* Dark mode — one block, zero duplicated component styles */<br>@media (prefers-color-scheme: dark) {<br>  :root {<br>    --color-primary: #60a5fa;<br>    --color-surface: #111827;<br>    --color-text: #f9fafb;<br>  }<br>}<br><br>/* Theming a specific section differently */<br>.admin-panel {<br>  --color-primary: #7c3aed;<br>  --color-surface: #1e1b4b;<br>}</pre><p>Every component inside .admin-panel now uses purple. You didn&#39;t touch a single component. No prop threading, no context providers, just cascadem the mechanism CSS was built on.</p><p>Tailwind’s dark mode story involves dark: prefixes duplicated on every element. dark:bg-gray-900 dark:text-white dark:border-gray-700. That&#39;s not a dark mode system, that&#39;s dark mode written by hand, twice, everywhere.</p><h3>What Tailwind was actually trying to solve</h3><p>Tailwind wasn’t born stupid. It emerged at a time when CSS tooling was genuinely painful. Tailwind gave teams a vocabulary, a spacing scale, a color palette, a set of constraints that made designs more consistent than they’d been before.</p><p>That was real value.</p><p>But it solved those problems by locking the answer inside a framework, instead of using the platform features that were already arriving to solve them properly. CSS Custom Properties landed in Chrome 49, Firefox 31, Safari 9.1. They’ve been baseline for years, and they solve the actual problem natively, at scale, with zero dependencies.</p><h3>If it’s not native it’s a dependency</h3><p>CSS is native. Every browser ships it. No configuration, no PostCSS, no tailwind.config.js, no purging, no JIT mode, no IntelliSense plugin, no wondering why your styles aren&#39;t showing up because you forgot to include the content glob.</p><p>You open a CSS file. You write styles. They work.</p><p>Tailwind requires:</p><ul><li>PostCSS</li><li>The Tailwind PostCSS plugin</li><li>A configuration file</li><li>A content configuration that tells it which files to scan</li><li>A build step that generates the actual CSS</li><li>Ideally the VSCode extension so autocomplete works</li><li>And increasingly, a Tailwind v3 vs v4 migration story you didn’t ask for</li></ul><p>Every one of those is a thing that can break, go out of date, conflict with another tool, or confuse a new team member. This is not a small cost. It’s a layer of accidental complexity you pay on every project, forever.</p><p>The web platform doesn’t ask for any of this. Neither does a .css file.</p><h3>The counter-arguments (and why they don’t hold)</h3><p><strong>“Scoped styles solve the naming problem.”</strong> CSS Modules and scoped CSS have existed for years. BEM exists. You were never forced to have global style conflicts. The naming problem Tailwind solves was already solved.</p><p><strong>“It’s faster to write.”</strong> Marginally, once you’ve memorized the class names. And only for the author. Every person after you pays the full cognitive price.</p><p><strong>“AI agents write Tailwind really well.”</strong> They do. They also write bg-blue-500 when your design token is --color-primary. They use w-[347px] because it&#39;s the path of least resistance. Stylelint on top of custom properties catches both. eslint-plugin-tailwindcss catches neither.</p><p><strong>“Design systems are easier with Tailwind tokens.”</strong> See the entire section above. CSS custom properties are more powerful, zero-dependency, and debuggable natively in DevTools. --color-primary is a design token. It doesn&#39;t need a framework.</p><h3>The industry will correct</h3><p>Tailwind had a real moment. It filled a genuine gap when CSS’s native capabilities weren’t there yet. But CSS has grown up. Custom properties are powerful and universally supported. @layer gives you cascade control. Container queries are shipping. :has() changed what selectors can express. The language evolved to address the problems Tailwind was solving, without PostCSS, without config, without a v4 migration.</p><p>Tailwind is a framework solving problems the platform now solves natively, at the cost of coupling your entire styling model to a non-standard abstraction that has already broken backward compatibility twice.</p><p>The best frontend architecture is the one that survives the frameworks. HTML survives. CSS survives. Tailwind is on its third major version with meaningful migration costs between each.</p><p>Write CSS. Define your tokens as custom properties. Scope your styles with Modules. Lint with Stylelint.</p><p>Your future self — and everyone who touches the codebase after you — will read it and just understand it.</p><p>That was always the goal.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4470d05d7d8a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>