-
Notifications
You must be signed in to change notification settings - Fork 243
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
Conversation
c70f333
to
d3fceef
Compare
packages/optimizer/spec/transformers/valid/RewriteAmpUrls/adds_preloads/input.html
Outdated
Show resolved
Hide resolved
packages/optimizer/spec/transformers/valid/RewriteAmpUrls/adds_esm_and_preloads/input.html
Outdated
Show resolved
Hide resolved
@@ -60,6 +60,7 @@ const {calculateHost} = require('../RuntimeHostHelper'); | |||
class RewriteAmpUrls { | |||
constructor(config) { | |||
this.esmModulesEnabled = config.esmModulesEnabled !== false; | |||
this.preloadEnabled = config.preloadEnabled === true; |
There was a problem hiding this comment.
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
)?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 17cd9bd
I would suggest implementing this option in the following way:
|
I've removed the option to control whether preload links are added and now made it conditional based on whether the boilerplate is present. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
* 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
See ampproject/amp-toolbox-php#17.
cf. ampproject/amp-toolbox-php#261