salsify / ember-css-modules

CSS Modules for ambitious applications
MIT License
282 stars 50 forks source link

Replace local-class with class at build time instead of runtime #284

Open runspired opened 2 years ago

runspired commented 2 years ago

I may work on adding this feature, putting this out there to see what support there is for it. Basically a build-time only version ember-css-modules.

scottmessinger commented 2 years ago

I would love this.

dfreeman commented 2 years ago

I know @turbo87 has expressed interest in this in the past as well.

I definitely see the appeal of doing all the work at build time, and would be super interested to see exploration in that space. If that's a route you want to explore, though, I'd strongly recommend not trying to build it on top of/into this package, but rather as something standalone. Maybe that's what you're suggesting?

Directionally I think where we're heading here is for ember-css-modules to ultimately go away, leaving behind:

ECM v3 will likely aim to be a bridge between that approach and how things work today to aid in migrating.

That will put us on more even footing with how most of the rest of the world consumes CSS Modules, and it would eliminate some of the runtime overhead we have for classname resolution today. That said, this would be a step away from us having any firsthand knowledge of or interaction with the name generation process, which I think you'd need tight coupling with in order to fully translate local-class to class at build time.