Code Monkey home page Code Monkey logo

Comments (1)

jonkoops avatar jonkoops commented on July 20, 2024

Thanks for your proposal. I can understand the need to reduce complexity when working with a lot of classnames that should be applied only at certain breakpoints, especially with Tailwind. However, classnames is intended as a minimal API to conditionally apply classes and join them together, and parsing these kinds of specific expressions introduces a complexity and performance overhead that we don't want to incur.

The proposal here also breaks current API expectations, as currently a truthy value being passed as the value of an object will apply the key of said object to the class-list. If we were to adopt the proposal to accept a value that should be used as some kind of prefix then this would have to be considered a breaking change.

The prefixing itself is also problematic, as this is a syntax specific to Tailwind, so in order to remain portable we'd have to make this configurable, further complicating the existing API.

I would instead recommend you write your own utility function on top of classnames to handle this Tailwind specific optimization, it should not be more than ~10 LOC to carry in your own project. Perhaps even open-source it, as it might be useful for other Tailwind users.

from classnames.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.