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

feat: Update class safelist for darkmode support #17

Merged
merged 1 commit into from
Jul 16, 2024

Conversation

mattbearman
Copy link
Contributor

@mattbearman mattbearman commented Jul 11, 2024

This safelist is used to generate tailwind classes that cannot be inferred from the code, ie: where Shard::Colors.variant and Shard::Colors.variants are used.

Having to keep the updated manually is not an ideal solution, but for now it works, I'll be raising a ticket to investigate ways of populating this automatically.

The easiest way to test this locally is to copy the safelist array from this PR into demo/tailwind.config.js in the main shard repo and then run the demo. At this stage you'll be doing a regression test to ensure I haven't broken any of the existing components 😅

Although it should be pretty clear from the diff that this only adds new patterns and doesn't affect any existing ones 👍

@mattbearman mattbearman marked this pull request as draft July 11, 2024 10:01
@mattbearman
Copy link
Contributor Author

mattbearman commented Jul 11, 2024

@andrewjtait @naft-a hold off on reviewing this please, I just found some more I'll probably need to add

@mattbearman mattbearman marked this pull request as ready for review July 11, 2024 10:14
@mattbearman
Copy link
Contributor Author

@andrewjtait @naft-a now this is ready for review

@andrewjtait
Copy link

I'll be raising a ticket to investigate ways of populating this automatically.

I think the easiest way to resolve this is to not rely on it at all 😅 are the colour helpers that useful?

Copy link

@andrewjtait andrewjtait left a comment

Choose a reason for hiding this comment

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

Seems okay to me! I ran the precompile task locally, and it added 20kb to the uncompressed asset, and 1kb to the compressed one. Which I guess is fine for adding a new colour set for a theme!

It's not an ideal process though, as you've mentioned in your PR description. It still includes a whole lot of classes we don't use.

@mattbearman mattbearman merged commit 834c3a5 into main Jul 16, 2024
4 checks passed
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.

2 participants