Close Menu
    DevStackTipsDevStackTips
    • Home
    • News & Updates
      1. Tech & Work
      2. View All

      CodeSOD: A Unique Way to Primary Key

      July 22, 2025

      BrowserStack launches Figma plugin for detecting accessibility issues in design phase

      July 22, 2025

      Parasoft brings agentic AI to service virtualization in latest release

      July 22, 2025

      Node.js vs. Python for Backend: 7 Reasons C-Level Leaders Choose Node.js Talent

      July 21, 2025

      The best CRM software with email marketing in 2025: Expert tested and reviewed

      July 22, 2025

      This multi-port car charger can power 4 gadgets at once – and it’s surprisingly cheap

      July 22, 2025

      I’m a wearables editor and here are the 7 Pixel Watch 4 rumors I’m most curious about

      July 22, 2025

      8 ways I quickly leveled up my Linux skills – and you can too

      July 22, 2025
    • Development
      1. Algorithms & Data Structures
      2. Artificial Intelligence
      3. Back-End Development
      4. Databases
      5. Front-End Development
      6. Libraries & Frameworks
      7. Machine Learning
      8. Security
      9. Software Engineering
      10. Tools & IDEs
      11. Web Design
      12. Web Development
      13. Web Security
      14. Programming Languages
        • PHP
        • JavaScript
      Featured

      The Intersection of Agile and Accessibility – A Series on Designing for Everyone

      July 22, 2025
      Recent

      The Intersection of Agile and Accessibility – A Series on Designing for Everyone

      July 22, 2025

      Zero Trust & Cybersecurity Mesh: Your Org’s Survival Guide

      July 22, 2025

      Execute Ping Commands and Get Back Structured Data in PHP

      July 22, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      A Tomb Raider composer has been jailed — His legacy overshadowed by $75k+ in loan fraud

      July 22, 2025
      Recent

      A Tomb Raider composer has been jailed — His legacy overshadowed by $75k+ in loan fraud

      July 22, 2025

      “I don’t think I changed his mind” — NVIDIA CEO comments on H20 AI GPU sales resuming in China following a meeting with President Trump

      July 22, 2025

      Galaxy Z Fold 7 review: Six years later — Samsung finally cracks the foldable code

      July 22, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»News & Updates»So, You Want to Give Up CSS Pre- and Post-Processors…

    So, You Want to Give Up CSS Pre- and Post-Processors…

    April 17, 2025

    There was once upon a time when native CSS lacked many essential features, leaving developers to come up with all sorts of ways to make CSS easier to write over the years.

    These ways can mostly be categorized into two groups:

    1. Pre-processors
    2. Post-processors

    Pre-processors include tools like Sass, Less, and Stylus. Like what the category’s name suggests, these tools let you write CSS in their syntax before compiling your code into valid CSS.

    Post-processors work the other way — you write non-valid CSS syntax into a CSS file, then post-processors will change those values into valid CSS.

    There are two major post-processors today:

    • PostCSS
    • LightningCSS

    PostCSS is the largest kid on the block while Lightning CSS is a new and noteworthy one. We’ll talk about them both in a bit.

    I think post-processors have won the compiling game

    Post-processors have always been on the verge of winning since PostCSS has always been a necessary tool in the toolchain.

    The most obvious (and most useful) PostCSS plugin for a long time is Autoprefixer — it creates vendor prefixes for you so you don’t have to deal with them.

    /* Input */
    .selector {
      transform: /* ... */; 
    }
    
    .selector {
      -webkit-transform: /* ... */;
      transform: /* ... */;
    }

    Arguably, we don’t need Autoprefixer much today because browsers are more interopable, but nobody wants to go without Autoprefixer because it eliminates our worries about vendor prefixing.

    What has really tilted the balance towards post-processors includes:

    1. Native CSS gaining essential features
    2. Tailwind removing support for pre-processors
    3. Lightning CSS

    Let me expand on each of these.

    Native CSS gaining essential features

    CSS pre-processors existed in the first place because native CSS lacked features that were critical for most developers, including:

    • CSS variables
    • Nesting capabilities
    • Allowing users to break CSS into multiple files without additional fetch requests
    • Conditionals like if and for
    • Mixins and functions

    Native CSS has progressed a lot over the years. It has gained great browser support for the first two features:

    • CSS Variables
    • Nesting

    With just these two features, I suspect a majority of CSS users won’t even need to fire up pre-processors or post-processors. What’s more, The if() function is coming to CSS in the future too.

    But, for the rest of us who needs to make maintenance and loading performance a priority, we still need the third feature — the ability to break CSS into multiple files. This can be done with Sass’s use feature or PostCSS’s import feature (provided by the postcss-import plugin).

    PostCSS also contains plugins that can help you create conditionals, mixins, and functions should you need them.

    Although, from my experience, mixins can be better replaced with Tailwind’s @apply feature.

    This brings us to Tailwind.

    Tailwind removing support for pre-processors

    Tailwind 4 has officially removed support for pre-processors. From Tailwind’s documentation:

    Tailwind CSS v4.0 is a full-featured CSS build tool designed for a specific workflow, and is not designed to be used with CSS pre-processors like Sass, Less, or Stylus. Think of Tailwind CSS itself as your pre-processor — you shouldn’t use Tailwind with Sass for the same reason you wouldn’t use Sass with Stylus. Since Tailwind is designed for modern browsers, you actually don’t need a pre-processor for things like nesting or variables, and Tailwind itself will do things like bundle your imports and add vendor prefixes.

    If you included Tailwind 4 via its most direct installation method, you won’t be able to use pre-processors with Tailwind.

    @import `tailwindcss`

    That’s because this one import statement makes Tailwind incompatible with Sass, Less, and Stylus.

    But, (fortunately), Sass lets you import CSS files if the imported file contains the .css extension. So, if you wish to use Tailwind with Sass, you can. But it’s just going to be a little bit wordier.

    @layer theme, base, components, utilities;
    
    @import "tailwindcss/theme.css" layer(theme);
    @import "tailwindcss/preflight.css" layer(base);
    @import "tailwindcss/utilities.css" layer(utilities);

    Personally, I dislike Tailwind’s preflight styles so I exclude them from my files.

    @layer theme, base, components, utilities;
    @import 'tailwindcss/theme.css' layer(theme);
    @import 'tailwindcss/utilities.css' layer(utilities);

    Either way, many people won’t know you can continue to use pre-processors with Tailwind. Because of this, I suspect pre-processors will get less popular as Tailwind gains more momentum.

    Now, beneath Tailwind is a CSS post-processor called Lightning CSS, so this brings us to talking about that.

    Lightning CSS

    Lightning CSS is a post-processor can do many things that a modern developer needs — so it replaces most of the PostCSS tool chain including:

    • postcss-import
    • postcss-preset-env
    • autoprefixer

    Besides having a decent set of built-in features, it wins over PostCSS because it’s incredibly fast.

    Lightning CSS is over 100 times faster than comparable JavaScript-based tools. It can minify over 2.7 million lines of code per second on a single thread.

    Comparing build times for CSS Nano (544 milliseconds), ES Build (17 milliseconds), and Lightning CSS (4 milliseconds).

    Speed helps Lightning CSS win since many developers are speed junkies who don’t mind switching tools to achieve reduced compile times. But, Lightning CSS also wins because it has great distribution.

    It can be used directly as a Vite plugin (that many frameworks support). Ryan Trimble has a step-by-step article on setting it up with Vite if you need help.

    // vite.config.mjs
    export default {
      css: {
        transformer: 'lightningcss'
      },
      build: {
        cssMinify: 'lightningcss'
      }
    };

    If you need other PostCSS plugins, you can also include that as part of the PostCSS tool chain.

    // postcss.config.js
    // Import other plugins...
    import lightning from 'postcss-lightningcss'
    
    export default {
      plugins: [lightning, /* Other plugins */],
    }

    Many well-known developers have switched to Lightning CSS and didn’t look back. Chris Coyier says he’ll use a “super basic CSS processing setup” so you can be assured that you are probably not stepping in any toes if you wish to switch to Lightning, too.

    If you wanna ditch pre-processors today

    You’ll need to check the features you need. Native CSS is enough for you if you need:

    • CSS Variables
    • Nesting capabilities

    Lightning CSS is enough for you if you need:

    • CSS Variables
    • Nesting capabilities
    • import statements to break CSS into multiple files

    Tailwind (with @apply) is enough for you if you need:

    • all of the above
    • Mixins

    If you still need conditionals like if, for and other functions, it’s still best to stick with Sass for now. (I’ve tried and encountered interoperability issues between postcss-for and Lightning CSS that I shall not go into details here).

    That’s all I want to share with you today. I hope it helps you if you have been thinking about your CSS toolchain.


    So, You Want to Give Up CSS Pre- and Post-Processors… originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.

    Source: Read More 

    Facebook Twitter Reddit Email Copy Link
    Previous ArticleRilasciata KDE Gear 25.04: La Collezione di Applicazioni KDE si Rinnova con Tante Novità
    Next Article 5 Business Benefits of Investing in AI-Powered Performance Testing

    Related Posts

    News & Updates

    The best CRM software with email marketing in 2025: Expert tested and reviewed

    July 22, 2025
    News & Updates

    This multi-port car charger can power 4 gadgets at once – and it’s surprisingly cheap

    July 22, 2025
    Leave A Reply Cancel Reply

    For security, use of Google's reCAPTCHA service is required which is subject to the Google Privacy Policy and Terms of Use.

    Continue Reading

    CVE-2025-54138 – LibreNMS Remote File Inclusion Vulnerability

    Common Vulnerabilities and Exposures (CVEs)

    Try It On: A Playful Drag-and-Drop Styling UI

    News & Updates

    This popular Soulslike game has fans divided on a controversial change

    News & Updates

    Developing reliable AI tools for healthcare

    Artificial Intelligence

    Highlights

    CVE-2025-40734 – Daily Expense Manager Cross-Site Scripting (XSS)

    June 30, 2025

    CVE ID : CVE-2025-40734

    Published : June 30, 2025, 9:15 a.m. | 46 minutes ago

    Description : Reflected Cross-Site Scripting (XSS) vulnerability in Daily Expense Manager v1.0. This vulnerability allows an attacker to execute JavaScript code by sending a POST request through the password and confirm_password parameters in /register.php.

    Severity: 0.0 | NA

    Visit the link for more details, such as CVSS details, affected products, timeline, and more…

    CVE-2025-6948 – GitLab Cross-Site Scripting (XSS) Vulnerability

    July 10, 2025

    CVE-2025-3638 – Moodle CSRF in Brickfield Tool

    April 25, 2025

    CVE-2025-1331 – IBM CICS TX Buffer Overflow Vulnerability

    May 8, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.