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

Disable preloading runtime script/style by default #1248

Merged
merged 6 commits into from
Jun 30, 2021

Conversation

westonruter
Copy link
Member

@@ -60,6 +60,7 @@ const {calculateHost} = require('../RuntimeHostHelper');
class RewriteAmpUrls {
constructor(config) {
this.esmModulesEnabled = config.esmModulesEnabled !== false;
this.preloadEnabled = config.preloadEnabled === true;
Copy link
Member Author

@westonruter westonruter Jun 26, 2021

Choose a reason for hiding this comment

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

Should this only be honored if the boilerplate was removed (i-amphtml-no-boilerplate)?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, only if boilertplate has been removed. I'm wondering whether we should make it configurable at all. I'd tend to remove the option.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done in 17cd9bd

@schlessera
Copy link
Collaborator

I would suggest implementing this option in the following way:

preloadRuntime (string):

  • always => always preload the runtime script
  • never => never preload the runtime script
  • auto (default) => preload the runtime script iff the boilerplate is still present

@westonruter westonruter marked this pull request as ready for review June 29, 2021 23:08
westonruter added a commit to ampproject/amp-toolbox-php that referenced this pull request Jun 29, 2021
@westonruter
Copy link
Member Author

I've removed the option to control whether preload links are added and now made it conditional based on whether the boilerplate is present.

westonruter added a commit to ampproject/amp-toolbox-php that referenced this pull request Jun 29, 2021
Copy link
Collaborator

@sebastianbenz sebastianbenz left a comment

Choose a reason for hiding this comment

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

Thanks!

@sebastianbenz sebastianbenz merged commit 1ce81d6 into main Jun 30, 2021
@sebastianbenz sebastianbenz deleted the remove/runtime-preloading branch June 30, 2021 16:45
sebastianbenz pushed a commit that referenced this pull request Jul 2, 2021
* Disable preloading runtime script/style by default

* Invert logic for preloadEnabled config to ensure disabled by default

* Automatically omit preloads only when boilerplate is removed

* Manually remove modulepreload from expected_output.fast.html

* Update expected output in end-to-end tests

* Update style[amp-custom] in end-to-end expected output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants