Comments (9)
Or is there going to be some advantage of classnames v3 over clsx?
I personally have been toying with the idea of simplifying the API of classnames to reduce the complexity of our code, and hopefully increase performance while we're at it. But this will still require some discussion on what the final implementation should be.
I'd also like to offer an even more basic version of classnames that only accepts strings (much like clsx), as you can pretty much express all you need with string | false
, but might be considered non-preferential for most users stylistically (objects are kinda nice).
Aside from that we offer style binding (e.g. for CSS modules), and a unique 'dedupe' alternative. We still have to decide what needs to be preserved from this, or revisited in API. I myself would like to refactor the style binding variant to have a more intuitive API, I think there is still value in that for our users.
As for the 'dedupe' variant, I don't really see any practical cases where you would want to dedupe classes, or even run into a scenario where your expressions have become so complex it would occur naturally. Also the impact of having a class duplicated is virtually non-existent, but perhaps there are historical reasons for this.
Stupid idea maybe, but would it make sense to just say the next version of classnames is clsx?
I don't think this is a stupid idea at all, one of the many issues in the JavaScript ecosystem is the choice overload that persists. And we have a lot of overlap with clsx, so it does make a lot of sense to see if we can combine our efforts here.
I think there are a couple of differences between our philosophies though (note personal opinion ahead), we both strive for excellent performance (note we are pretty competitive), but clsx obsesses a bit about file-size to the point where I think the returns are diminishing, we're only shipping a single utility function after all.
Another point we differ is that clsx is backwards compatible all the way back to Node.js v0.10.0 and Internet Explorer 8. Which is impressive, but I sincerely doubt that it is being executed in any such runtime that still exists in the wild. I prefer more modern syntax support if that can open up the gates to better performance (e.g. using Set
for de-duplication), but further testing is required to confirm this is the case.
We also have plans to possibly drop UMD and CommonJS and favor a purely ESM distribution (#349), as I believe there is a lot of value in finally settling on a common set of primitives around modules. Note, we will continue to support v2 for the foreseeable future to bridge that gap.
That said, perhaps our differences can be settled, APIs combined, and we can make a better alternative to all involved. For now at least work will continue on classnames, and we're actively looking to the future, whatever that may be.
from classnames.
@dcousens @JedWatson WDYT? Is this strategy something you can get behind as well?
from classnames.
from classnames.
@agrant-1 Please refrain from sending e-mails to this GitHub thread, it will not unsubscribe you. Do so by selecting 'Unwatch' on the main page of the repository.
from classnames.
Sounds good to me, but I wouldn't bother with a v2
branch unless we need to go back to that branch - as you say, it's unlikely. git
has the history.
from classnames.
Perfect, I've created a v2.0
branch for now (we can always delete it), so that if we make changes in the docs we can link there for users that might want to read the 'legacy' docs.
from classnames.
Let's keep this issue open to coordinate the work needed for 3.0 in general.
from classnames.
I went ahead and deleted the next
branch, as there was nothing of great value there left to port over.
from classnames.
Stupid idea maybe, but would it make sense to just say the next version of classnames is clsx? Or is there going to be some advantage of classnames v3 over clsx? Currently clsx claims to be faster and smaller, and it's also now more popular.
from classnames.
Related Issues (20)
- why not using one build tool for publish the npm package? HOT 2
- Incomplete type signature for classnames/bind HOT 2
- Advanced typing for classnames/bind HOT 4
- Explain to me about "cx" HOT 1
- Getting error says 'this' context of type 'void' is not assignable HOT 4
- [Question] When I used Object's value to computed key, what happened? HOT 2
- SyntaxError: Unexpected end of script (Mobile Safari) HOT 5
- When no classes are selected, classNames should return null HOT 5
- Vulnerable dependencies (indirect security issues) HOT 1
- How to erase or replace the properties of the conditional class from external component? HOT 1
- why number can be a className HOT 1
- Can we add exports field for this package? HOT 4
- Need a maintainer? HOT 7
- Should we support CommonJS for 3.0? HOT 5
- No default export (v2.5.1) HOT 5
- Import from 'classnames' broken since v2.5.0 HOT 5
- Please use GitHub Releases HOT 6
- Unable to do v2 releases HOT 2
- Feature Request: Enhanced Responsive Classnames Support HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from classnames.