salsify / ember-css-modules

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

Support for ember-template-imports? #318

Open deanylev opened 8 months ago

deanylev commented 8 months ago

Are there any plans to support ember-template-imports? We were planning to switch our new components over to that but unfortunately it appears ember-css-modules is incompatible. The outputted HTML simply includes the local-class attribute verbatim, instead of transforming it to the mangled class attribute.

deanylev commented 8 months ago

Appears the local-class helper works in the meantime which leads me to think fixing this properly shouldn't be too hard. I've taken a look myself but I'm not really sure why the local class helper injection hack works in normal components but not gjs/gts ones.

deanylev commented 8 months ago

Narrowed it down to this line https://github.com/salsify/ember-css-modules/blob/409cc26b93cca9dadd14c7825fb393abfd1be182/packages/ember-css-modules/lib/htmlbars-plugin/index.js#L52 but doesn't work due to strict mode 😕 wonder if the automagic local-class attribute replacement will be possible in that case

dfreeman commented 8 months ago

We're planning on a pretty major overhaul (or really, stripping down) of ember-css-modules. The end result will lean heavily on the bundler (Webpack via ember-auto-import, or Webpack/Vite via Embroider) to handle the actual "CSS Modules" of it all, and the only custom bit left will be the local-class transform.

The goal there will be full compatibility with Embroider's strictest settings and FCCTs (a.k.a ember-template-imports) for those who want to keep using the local-class attribute going forward rather than importing and directly referencing the styles hash themselves.

To temper your expectations, though, I currently have that work lined up to likely happen around May or June, depending on how a couple of other internal projects I'll be taking on at work over the next few months go.

deanylev commented 1 month ago

@dfreeman any update on when support for this will be added? 🙏

dfreeman commented 1 month ago

Yes! I started on this work in June, but have been on vacation for the past six weeks—I start back at work on Monday, and will keep you updated here as there's progress :)