Skip to content

Disable preloading runtime script/style by default#1248

Merged
sebastianbenz merged 6 commits intomainfrom
remove/runtime-preloading
Jun 30, 2021
Merged

Disable preloading runtime script/style by default#1248
sebastianbenz merged 6 commits intomainfrom
remove/runtime-preloading

Conversation

@westonruter
Copy link
Copy Markdown
Member

@westonruter westonruter force-pushed the remove/runtime-preloading branch from c70f333 to d3fceef Compare June 26, 2021 00:10
class RewriteAmpUrls {
constructor(config) {
this.esmModulesEnabled = config.esmModulesEnabled !== false;
this.preloadEnabled = config.preloadEnabled === true;
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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