tyler-johnson / stripe-meteor

A Meteor package containing Stripe.js, Node-Stripe, and Stripe Checkout.
https://atmospherejs.com/mrgalaxy/stripe
150 stars 44 forks source link

Slow load times #30

Open jbrozena22 opened 9 years ago

jbrozena22 commented 9 years ago

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.

vectorselector commented 9 years ago

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

vectorselector commented 9 years ago

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); }

MendelYev commented 9 years ago

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.