mizdra / happy-css-modules

Typed, definition jumpable CSS Modules. Moreover, easy!
MIT License
213 stars 5 forks source link

Support for `@value` definitions #212

Closed samhh closed 2 weeks ago

samhh commented 11 months ago

Hey! Off the back of https://github.com/mizdra/happy-css-modules/issues/200#issuecomment-1539878340 I wondered if you may consider support for @value variables:

@value foo: anything;
import styles from './file.css'

styles.foo // string

This would match the behaviour of Webpack and typed-css-modules.

Cheers!

mizdra commented 11 months ago

Thanks for the proposal!

I misunderstood the behavior with @value. I see that values defined with @value are also exported (I created a demo project to confirm this behavior).

Surely it would be desirable to support this behavior in happy-css-modules as well. I will consider implementing it.

mizdra commented 8 months ago

I was too busy to work on it. However, I will resume this work when I have time. Please wait for further updates!

Grawl commented 8 months ago

the same with :export from icss

mizdra commented 8 months ago

@Grawl Thanks for your comment!

I thought ICSS was a syntax that bundler outputs internally, not for people to write. So happy-css-modules is not designed to work with ICSS. happy-css-modules does not have a test case for ICSS, so it is not guaranteed to work with ICSS.

If you want ICSS to work with happy-css-modules, could you please create a new issue? We need to discuss how much work is needed there.

Grawl commented 8 months ago

Just didn't knew there is @value syntax

mizdra commented 2 weeks ago

This feature is shipped in v3.1.0. Thanks to @samhh for contributing to this feature!

https://github.com/mizdra/happy-css-modules/releases/tag/v3.1.0