0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Updated Stripe JS to load async in head

no issue

- Stripe JS is added to a theme via ghost_head if a Stripe account is connected to members enabled site
- Previously, the script was not loading async which blocked the main thread, changes the script load to async to avoid rendering block
- Members script is already being loaded with `defer` so does not block the main thread
This commit is contained in:
Rish 2020-08-17 09:38:14 +05:30 committed by Daniel Lockyer
parent f8f0f76788
commit 1a6eec40d1

View file

@ -46,7 +46,7 @@ function getMembersHelper() {
membersHelper = `<script defer src="https://unpkg.com/@tryghost/members-js@latest/umd/members.min.js" data-ghost="${urlUtils.getSiteUrl()}"></script>`; membersHelper = `<script defer src="https://unpkg.com/@tryghost/members-js@latest/umd/members.min.js" data-ghost="${urlUtils.getSiteUrl()}"></script>`;
} }
if ((!!stripeDirectSecretKey && !!stripeDirectPublishableKey) || !!stripeConnectAccountId) { if ((!!stripeDirectSecretKey && !!stripeDirectPublishableKey) || !!stripeConnectAccountId) {
membersHelper += '<script src="https://js.stripe.com/v3/"></script>'; membersHelper += '<script async src="https://js.stripe.com/v3/"></script>';
} }
return membersHelper; return membersHelper;
} }