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

Switch to css modules #438

Merged
merged 1 commit into from
Nov 29, 2023
Merged

Switch to css modules #438

merged 1 commit into from
Nov 29, 2023

Conversation

jas7457
Copy link

@jas7457 jas7457 commented Nov 27, 2023

This follows a conversation that was had on slack regarding whether to push people towards css modules or not during the switch to vite. Since ?url does not work properly for production, we can use css modules for now.

I removed some global html,body styles that I thought were superfluous, but if you disagree, let me know and we can import it globally.

@jas7457 jas7457 requested a review from a team as a code owner November 27, 2023 20:22
@jas7457 jas7457 requested a review from paulomarg November 27, 2023 20:22
Comment on lines 11 to 12
.h1,
.p {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, question about this. Originally, this style would apply to ALL h1 and p tags, right? But now it's only those with the given class. Wouldn't this be better to just apply whatever Module Class name is generated to the outer most component in the render function, and still get these applied?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, question about this. Originally, this style would apply to ALL h1 and p tags, right?

Before the switch to vite, it would apply to all h1 and p tags on the route, but would then be removed on route transition and not affect other routes. We could change it to something like .index h1, .index p, but TBH, I've always disliked styling based on tags and would shy away from it. A good example is if we used the Polaris <Text> component and it ends up rendering an h1 or a p, do we really want to style the output of the <Text> component? Probably not.

Or maybe use the :global exception?

We wouldn't want to use global, because that would change every h1, p, etc in the app to use those styles, and would not be removed on route change.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is fair - if the styles would linger after a route is unloaded, then we should be specific with them here.

Should we use more semantic class names, like we do for .index and .content, as opposed to more generic ones like .h1? I feel like that might also alleviate some of the "weirdness" of switching to classes.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I'm fine with using more semantic class names, I was debating that, good call out.

Rename classes
@jas7457 jas7457 merged commit 614fb9f into use_vite Nov 29, 2023
@jas7457 jas7457 deleted the jaddleman/use_vite branch November 29, 2023 15:23
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

Successfully merging this pull request may close these issues.

3 participants