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

Add defer to <script> in <head> #2488

Closed
wants to merge 6 commits into from
Closed

Conversation

niutech
Copy link

@niutech niutech commented Apr 16, 2024

Description

This PR adds defer attribute to <script> tags in <head> for better web performance. Without it, the JS script is blocking web page until it is loaded, parsed and executed.

Corresponding issue: #2473

Testing

Please explain how you tested this change manually, and, if applicable, what new tests you added. If
you're making a change to just the website, you can omit this section.

Checklist

  • I have read the contribution guidelines
  • I have targeted this PR against the correct branch (master for website changes, dev for
    source changes)
  • This is either a bugfix, a documentation update, or a new feature that has been explicitly
    approved via an issue
  • I ran the test suite locally (npm run test) and verified that it succeeded

@Telroshan Telroshan added documentation Improvements or additions to documentation performance labels Apr 16, 2024
@alexpetros
Copy link
Collaborator

No, sorry. If the script wasn't loaded, then the hx- functionality wouldn't work. Users are able to decide how they want to optimize their page on their own, but we're not going to default our documentation to it.

@niutech
Copy link
Author

niutech commented Apr 26, 2024

@alexpetros I don't get it. Could you elaborate exactly which hx- functionality doesn't work with defer? Here is a simple demo with defer which works just fine.
Moreover, you should promote good web performance practices and not put it on (often unexperienced) web devs.

@alexpetros
Copy link
Collaborator

Will follow up on the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants