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

Lazy load the scripts needed for certain sources #91

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

rjyo
Copy link

@rjyo rjyo commented Nov 18, 2019

Problem: When not all the pages need embedding, using SSR to add the scripts (on all pages) will damage the whole site's speed score (benchmarked with Google's PageSpeed Insights).

Solution: This PR will move the SSR injected scripts to the client side. As thus they will only be loaded on the pages(blogs) with embeds.

@raae
Copy link
Member

raae commented Dec 30, 2019

I have been thinking it should be possible to check for the embeds server-side as well. Add a flag to the pages when embeds are processed.

I am a little afraid to check for things like blockquote.instagram-media as they might change the html we get back from their endpoints at any time.

@raae
Copy link
Member

raae commented Jan 28, 2020

We might secretly add the elements to options, so if they break user can fix it by overriding the elements without having to wait for us to fix it.

@nickytonline
Copy link
Collaborator

Just following up on this PR. I like the idea of this as we should only be loading scripts that we require. Is this something you still want to work on @rjyo?

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

3 participants