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

Doesn't handle multiple files with same namespace #24

Open
raystubbs opened this issue Jan 12, 2024 · 6 comments
Open

Doesn't handle multiple files with same namespace #24

raystubbs opened this issue Jan 12, 2024 · 6 comments

Comments

@raystubbs
Copy link

I have an icons.clj with a macro for generating icon markup, and an icon.cljs with :require-macros. The CSS for icons.clj never gets generated. It looks like multiple files with the same ns will override each other.
image

@thheller
Copy link
Owner

Hmm right, not something I considered. Will think about it.

@thheller
Copy link
Owner

thheller commented Jan 13, 2024

This is a surprisingly difficult thing to get right. While it won't be common it is absolutely possible to have both files use a (css ..) form in the exact same spot. That would lead to a conflict, since all that is considered for the generated classname is the ns, line and column.

So, maybe the generation needs to consider whether it is a CLJ or CLJS context, which then becomes tricky for CLJC since thats often both at the same time.

Will think about it some more ...

@thheller
Copy link
Owner

FWIW one possible fix is using a .cljc file instead of two separate files. Not something I usually recommend but reasonable for this case.

@raystubbs
Copy link
Author

Huh, hadn't thought of that. Good idea.

@philjackson
Copy link
Contributor

@thheller Could shadow-css work on files rather than namespaces?

@thheller
Copy link
Owner

thheller commented Apr 5, 2024

Maybe. See my comment from above.

My first attempt at fixing this issue was exactly that. Ran into quite a few quirks, so ultimately shelved it. One of the limiting things being that its not always easy to get the filename in the macro context (for example stuff eval'd at the REPL).

Didn't have too much time to think about this yet.

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