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

simplify code in generated <script />. Update index.tsx #175

Closed
wants to merge 6 commits into from

Conversation

dimaMachina
Copy link
Contributor

@dimaMachina dimaMachina commented Apr 26, 2023

Currently next-themes generate code that can be simplified
image
when defaultSystem is true => if (e==='system' || !e)
when defaultSystem is false => if (e==='system') (no need to check always evaluates to false due && operator

update:

also below code
image

can be simplified to
image

update2

renamed s to x because it could be reserved https://github.com/B2o5T/next-themes/blob/a199ee818c108185d1590f8552a29be0c9f4f3fa/src/index.tsx#L196

@vercel
Copy link

vercel bot commented Apr 26, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
next-themes-basic ❌ Failed (Inspect) Apr 27, 2023 11:39am
next-themes-tailwind ❌ Failed (Inspect) Apr 27, 2023 11:39am

src/index.tsx Outdated Show resolved Hide resolved
src/index.tsx Outdated Show resolved Hide resolved
src/index.tsx Outdated Show resolved Hide resolved
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