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

Moving scripts to <head> by default #874

Merged
1 commit merged into from
Jan 15, 2021
Merged

Moving scripts to <head> by default #874

1 commit merged into from
Jan 15, 2021

Conversation

weaverryan
Copy link
Member

@weaverryan weaverryan commented Jan 15, 2021

Hi!

This is "kind of" a big change from a documentation POV, though the docs PR to update things was very small (and I'll check SymfonyCasts for any notes needed).

Having script tags in the head is more performant (and works well with Turbo) AND has the same behavior as putting the scripts at the bottom as long as you use <script defer. In WebpackEncore 1.9, you can now specify to add defer automatically on all script tags and the new 1.9 recipe enables this by default

So, things should "just work" like before, but some docs will need to be updated.

Q A
License MIT
Doc issue/PR symfony/symfony-docs#14836

TODO

  • Give this a quick test
  • Make a docs PR

With <script defer, execution is still done after page load, but is more performant
and works will with Turbo
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Pull request passes validation.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Pull request passes validation.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Pull request passes validation.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Pull request passes validation.

@ghost ghost merged commit f5bd952 into symfony:master Jan 15, 2021
@weaverryan weaverryan deleted the encore-1.9-defer-scripts branch January 15, 2021 19:42
@fabpot
Copy link
Member

fabpot commented Jan 16, 2021

Besides the docs and videos, it also has a big impact (like any recipe change that does not target the next Symfony version) on the book.

I've mentioned that in the past, but I think we should not make such changes in past version and limit them to the next minor version.

@fabpot
Copy link
Member

fabpot commented Jan 16, 2021

I forgot to mention that it also makes some blog posts not working anymore. If one tries to follow the book examples, the patches won't apply cleanly anymore. That should not happen IMHO. We should not break the past.

javiereguiluz added a commit to symfony/symfony-docs that referenced this pull request Jan 17, 2021
…hange (weaverryan)

This PR was merged into the 4.4 branch.

Discussion
----------

Updating {% block javascripts position to match recipe change

Hi!

See symfony/recipes#874

I did this against 4.4 (which is normally done for bug fixes) because this *would* appear as a "documentation bug" if we updated the recipe but didn't update the docs.

Thanks!

Commits
-------

8c2c794 Updating {% block javascripts position to match recipe change
This pull request was closed.
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

4 participants