Hacker News new | ask | show | jobs
by philh 3555 days ago
It looks like CSS modules is meaningfully different from being just a naming convention.

With a naming convention, if you want to use work from two different packages and they happen to use the same names, you need to edit one of them. People come up with conventions to try to avoid this, like prefixing everything with the package name, but that doesn't fundamentally fix the problem. If two packages have the same name, they clash again. You have a fundamental tradeoff between short prefixes which are easy to work with, and long ones which are less likely to clash.

In other systems, when you use a package, you choose the prefix. If two packages use the same names, you just give them different prefixes. Short prefixes are fine, because they don't need to be globally unique.

It looks like CSS Modules works the second way, and that's an improvement over just being a naming convention.