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: reduce initial css load #145

Closed
wants to merge 2 commits into from
Closed

Conversation

anh-ld
Copy link

@anh-ld anh-ld commented Oct 15, 2023

What kind of changes does this PR include?

  • Reduce initial CSS load from 10.5KB to 7.9KB by lazy loading @pagefind/default-ui/css/ui.css and its customized CSS.

Description

  • I moved the @pagefind/default-ui/css/ui.css and the Search.astro's <style is:global> into styles/search.css and then lazy load the styles/search.css onIdle.

@netlify
Copy link

netlify bot commented Oct 15, 2023

Deploy Preview for astro-theme-cactus ready!

Name Link
🔨 Latest commit 1e02dec
🔍 Latest deploy log https://app.netlify.com/sites/astro-theme-cactus/deploys/6568a97c9d591c00086b05be
😎 Deploy Preview https://deploy-preview-145--astro-theme-cactus.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.

Copy link

This PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@chrismwilliams
Copy link
Owner

chrismwilliams commented Dec 1, 2023

Thanks for opening this and for taking the time to do this.

I appreciate the savings, but I'm not sure if this will trip some people up with View Transitions, it would require testing to make sure it's compatible as I've had some issue's with it already and ended up removing it.

There's also caching with the styles being in a .js file, and with the possibility of people clicking search before the styles have been processed.

What I can do is put a link in the README to your request as a possible solution to reduce initial load.

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.

None yet

2 participants