stripe-meteor icon indicating copy to clipboard operation
stripe-meteor copied to clipboard

Slow load times

Open jbrozena22 opened this issue 9 years ago • 3 comments

I am experiencing nearly a second load times waiting for the checkout.js.map to load from Stripe. This is fine on the page where I do my purchase, but I would prefer to not have the script loaded on all other pages to improve their load times.

Is there anyway to have the package insert the script into the html head only on pages of your choosing?

Thanks.

jbrozena22 avatar Mar 09 '15 13:03 jbrozena22

same issue... not possible to add in head as it's telescope... need only for specific template usage....

vectorselector avatar Jun 08 '15 13:06 vectorselector

in the end i had success using manuelschoebel:wait-on-lib package with iron:router to control only loading on the stripe-using template and wrapping the stripe setup with a .rendered function...

Template.myTemplate.rendered = function(){ STRIPE_PUBLISHABLE_KEY = Meteor.settings.public.stripePublishableKey; Stripe.setPublishableKey(STRIPE_PUBLISHABLE_KEY); }

vectorselector avatar Jun 08 '15 18:06 vectorselector

I've done a pull request to remove the header part responsible for this : https://github.com/tyler-johnson/stripe-meteor/pull/43

If you don't want to add an other package to load stripe dependencies, you can also use $.getScript inside a Template.myTemplate.rendered block. It worked well for me.

MendelYev avatar Oct 20 '15 16:10 MendelYev