CSSForge - Safely refactor legacy CSS into modern native CSS

by•
CSSForge is an open-source Rust CLI and interactive terminal workbench for forward CSS modernization. Refactor flat CSS into native nesting, modern selectors, range media queries and cleaner at-rule structures while checking specificity, cascade order and declaration preservation.

Add a comment

Replies

Best
Maker
šŸ“Œ
Hi Product Hunt šŸ‘‹ I built CSSForge after looking into a deceptively difficult CSS tooling problem: Why do we have many tools for compiling modern/nested CSS into flat CSS, but far fewer tools that can safely take an existing flat stylesheet and move it forward? The answer is the cascade. For example, this transformation may look harmless: .alpha .title, #hero .title {} → :is(.alpha, #hero) .title {} but it can change specificity. Likewise, gathering a .card:hover rule from later in a file into an earlier .card block can change source-order behavior. Moving declarations between cascade layers is even more sensitive. So I built CSSForge around a different rule: Don't transform because something looks equivalent. Transform only after checking whether it is equivalent. CSSForge is written in Rust and includes both an interactive TUI and headless CLI. The current rules cover native nesting, selector factoring, range media syntax, conditional at-rules, repeated blocks, identical rule bodies and other structural refactors. I also wanted the diffs to remain reviewable, so its documented mutation model patches targeted source ranges instead of reserializing the entire stylesheet. I'd really appreciate feedback from frontend/CSS developers on: selectors that are especially difficult to refactor cascade edge cases transformations you'd like CSSForge to support cases where a tool should refuse rather than guess Docs: Source: Thanks for checking it out.