Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how can you get globals on the exported object? #50

Closed
faceyspacey opened this issue Dec 11, 2016 · 10 comments
Closed

how can you get globals on the exported object? #50

faceyspacey opened this issue Dec 11, 2016 · 10 comments

Comments

@faceyspacey
Copy link

I don't see why globals can't be exported just like locals, thereby giving you a consistent API in your components, i.e. so you don't have to juggle between using keys on a styles object and className strings.

@madyankin
Copy link
Owner

Nice idea! Could you make a pull request?

@axyz
Copy link

axyz commented Jun 4, 2020

@Outpunk can you point us to what part of the code filters out globals? (not sure if it is in this repo or some css-modules nested dependencies).

This would be useful for my use case in https://github.com/utilitycss/atomic as I use the keys in the json to delete rules that are not exported (e.g. whole css files coming from ICSS imports and composes) (https://github.com/utilitycss/atomic/blob/master/src/postcss/remove-unused-electrons.ts)

I was thinking that I can parse the CSS and look for :global(.myClass) instances with a regexp and include them in the custom getJSON as "myClass": "myClass", but that sounds like a dirty solution and would be better to not remove them in the first place.

@madyankin
Copy link
Owner

madyankin commented Jun 4, 2020 via email

@madyankin
Copy link
Owner

@axyz I didn't forgot about this one. It has just a low priority among other my tasks. Hope, will dig into it this or next week

@axyz
Copy link

axyz commented Jun 9, 2020

@Outpunk sure, let me know if it is something I can help with given a little guidance, it is not super urgent but I want to avoid to put workarounds in place if possible.

@axyz
Copy link

axyz commented Jun 23, 2020

@Outpunk any update on this?

@madyankin
Copy link
Owner

@axyz I'm afraid, I have to rewrite the lib a bit first to avoid using dependencies css-modules/css-modules-loader-core#236 (comment)

@axyz
Copy link

axyz commented Jun 23, 2020

do you think is still realistic to have the feature relatively quickly if you go for copy pasting the dependencies for now? Just need to know in order to decide to go for an alternative solution in the meanwhile or not.

@madyankin
Copy link
Owner

madyankin commented Jun 23, 2020 via email

@madyankin
Copy link
Owner

@faceyspacey @axyz Released in 3.1.0 https://github.com/css-modules/postcss-modules#exporting-globals

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants