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

Refactor style.css #1786

Open
wants to merge 20 commits into
base: gh-pages
Choose a base branch
from
Open

Refactor style.css #1786

wants to merge 20 commits into from

Conversation

bjohansebas
Copy link
Member

To make it more maintainable and to better edit our styles, I am separating the styles into multiple files depending on their purpose.

@bjohansebas bjohansebas added the maintenance Issues/PRs related to making the website maintainable label Feb 11, 2025
Copy link

netlify bot commented Feb 11, 2025

Deploy Preview for expressjscom-preview ready!

Name Link
🔨 Latest commit 0e8e065
🔍 Latest deploy log https://app.netlify.com/sites/expressjscom-preview/deploys/67abd359ae86fd000884a401
😎 Deploy Preview https://deploy-preview-1786--expressjscom-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@bjohansebas bjohansebas marked this pull request as ready for review February 11, 2025 19:29
@bjohansebas bjohansebas requested review from a team as code owners February 11, 2025 19:29
@jonchurch
Copy link
Member

jonchurch commented Feb 11, 2025

What maintainability issues are you running into currently? That the styles file is 1200 lines long?

I see the value in organizing styles, but right now, this approach increases the number of HTTP requests without a build step to merge them (jekyll supports scss), which could negatively impact performance. We go from 1 request to 9.

Also, from a developer experience perspective, having to jump between multiple small files can sometimes make it harder to track down and modify styles efficiently. A single, well-structured file can often be easier to work with than several separate ones.

Some of these files, like menu.css, footer.css, and search.css, seem to be used across the site. Would it make sense to combine them into a single global.css? Similarly, instead of splitting each page’s styles into separate files, what about grouping them into one pages.css?

The goal should be improving maintainability without making performance worse or adding manual overhead. What do you think?

@bjohansebas
Copy link
Member Author

What maintainability issues are you running into currently? That the styles file is 1200 lines long?

It's a very large and somewhat disorganized file, so if we can separate it into a few files and organize it better, that would be great.

Some of these files, like menu.css, footer.css, and search.css, seem to be used across the site. Would it make sense to combine them into a single global.css? Similarly, instead of splitting each page’s styles into separate files, what about grouping them into one pages.css?

I like both options, I will apply them. Thanks for the suggestion!

@ShubhamOulkar
Copy link

ShubhamOulkar commented Feb 12, 2025

Please don't add files in header that are not present in repo. express.com showing same error in the console. ☹️

[2025-02-13 00:23:13] ERROR /css/themes/light-theme.css' not found.
LiveReload: Browser connected
[2025-02-13 00:23:28] ERROR /css/themes/light-theme.css' not found. [2025-02-13 00:25:47] ERROR /css/themes/light-theme.css' not found.
[2025-02-13 00:26:23] ERROR /css/themes/light-theme.css' not found.

Are you planning to add light-theme? I dont think it is needed. As @jonchurch said don't increase network calls. Just need to remove redundant css selectors. I can see that light mode text colors and background colors are not broken in this pr but I dont find light-theme.css file in pr.

@bjohansebas
Copy link
Member Author

[2025-02-13 00:23:13] ERROR /css/themes/light-theme.css' not found.
LiveReload: Browser connected

I forgot to remove that request from the head, sorry about that. I've deleted it in this pr.

Copy link

@ShubhamOulkar ShubhamOulkar left a comment

Choose a reason for hiding this comment

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

Api

add Basic accessibility like key :focus and :hover styles.
We still need to style responsive #menu bar on api/blog pages. Will be is done in pr #1775.

Blogs

Make changes in comment and moving blog side bar css code into blog.css file. This side bar also need changes in :focus, :hover selectors, responsive layout changes.

#menu {
position: fixed;
margin: 0;
padding: 0 10px 0 0;

Choose a reason for hiding this comment

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

Suggested change
padding: 0 10px 0 0;
padding-inline: 0.5rem;
padding-block: 0.5rem;

old css blocks left side of li element on :focus-visible. And use logical css because we dont want to write separate css on translated page. These property follows directions and writing mode.

image

}

#menu a {
color: var(--menu-grey);
Copy link

@ShubhamOulkar ShubhamOulkar Feb 13, 2025

Choose a reason for hiding this comment

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

Suggested change
color: var(--menu-grey);
color: var(--menu-grey);
display: block;
padding-block: 0.2rem;
padding-inline: 0.2rem;
margin-inline: 0.2rem;
border-radius: 0.2rem;
&:hover {
color: var(--fg);
}
&:focus {
outline: 1px solid var(--fg);
}

increase clicking area for all links

image

We need both selectors, and :focus to show same focus state across all browsers.

font-size: 13px;
}

#menu ul a {

Choose a reason for hiding this comment

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

Suggested change
#menu ul a {

#menu ul a {} is redundant selector remove it

}

#menu ul a {
padding-right: 7px;

Choose a reason for hiding this comment

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

Suggested change
padding-right: 7px;


#menu ul a {
padding-right: 7px;
}

Choose a reason for hiding this comment

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

Suggested change
}

}
}

/* -------- Submenu --------*/

Choose a reason for hiding this comment

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

Suggested change
/* -------- Submenu --------*/
/* -------- navigation Submenu --------*/

}
}

/* ----------------- Blog --------------------- */
Copy link

@ShubhamOulkar ShubhamOulkar Feb 13, 2025

Choose a reason for hiding this comment

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

Suggested change
/* ----------------- Blog --------------------- */
/* ----------------- Blog side bar --------------------- */

Can we put this in blog.css? I was thinking of using same blog side bar on guide page, security best practices and performance best practices pages.

}
}

/* ----------------- Side Menu --------------------- */

Choose a reason for hiding this comment

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

Suggested change
/* ----------------- Side Menu --------------------- */
/* ----------------- api Side Menu --------------------- */

ShubhamOulkar

This comment was marked as duplicate.

@bjohansebas
Copy link
Member Author

I'm trying not to delete or modify any CSS styles, as these are style changes of code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Issues/PRs related to making the website maintainable
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants