Skip to content

Optimizating (!important solution)#66

Open
dkconnect wants to merge 4 commits into
codergautam:masterfrom
dkconnect:master
Open

Optimizating (!important solution)#66
dkconnect wants to merge 4 commits into
codergautam:masterfrom
dkconnect:master

Conversation

@dkconnect

Copy link
Copy Markdown

I just tried doing this, loved this project and would love to contribute to improve it further.

The core optimization strategy for this code was centered on creating a design system using CSS Custom Variables. I introduced a new :root block to centralize all repeating values like colors, common spacing units, and key font sizes, because hardcoding these values makes future design changes or updates tedious and messy.

This also allowed for a cleanup by removing excessive use of the !important flag within the mobile media queries. I did this because !important creates a "specificity war," making the code fragile and difficult to override later.

The core optimization strategy for this code was centered on creating a design system using CSS Custom Variables. 
I introduced a new :root block to centralize all repeating values like colors, common spacing units, and key font sizes, because hardcoding these values makes future design changes or updates tedious and messy. 

This aso allowed for a cleanup by removing excessive use of the !important flag within the mobile media queries.\ I did this because !important creates a specificity war, making the code fragile and difficult to override later.
@codergautam

Copy link
Copy Markdown
Owner

Thanks for your PR! I will review soon. Currently swamped with college applications.

@codergautam codergautam reopened this Mar 30, 2026
@codergautam

Copy link
Copy Markdown
Owner

Thanks for the PR! I like the idea of cleaning up the CSS with variables.

Before I can merge this though, there are a few undefined CSS variables being used that aren't declared in the :root block:

  • --spacing-md
  • --spacing-sm
  • --radius-sm
  • --color-light-text
  • --color-dark-text

Some of these have fallback values (like var(--color-light-text, #ccc)) so they won't visually break, but others like margin-bottom: var(--spacing-md) have no fallback and will be
invalid CSS.

Could you add the missing variable definitions to :root and I'll merge it?

Hi @codergautam

Thanks for reviewing my earlier PR! I’ve added all the previously missing CSS variables to the :root block, including:

--spacing-md
--spacing-sm
--radius-sm
--color-light-text
--color-dark-text
@dkconnect

Copy link
Copy Markdown
Author

Hey @codergautam please have a look

@codergautam

Copy link
Copy Markdown
Owner

Looking soon

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