Scripts are not loading after logout

Hello people. I’m a beginner with Meteor. I have this problem. My App has two different pages. “Landing”, where I have an animated form to Log In, and “Home” where flowRouter redirects after successful Log In. My problem is, when I logout of my app (Return to Landing), the “Landing” is not loading my public scripts anymore and the animated form doesn’t work. Right now I’m calling this public scripts in my body like this:

<template name="App_body">
  <script src="https://code.jquery.com/jquery-3.2.1.js"> </script>
  <script src="/scripts/slidebars.js"></script>
  <script src="/scripts/scripts.js"></script>
  <script src="/scripts/masonry.pkgd.min.js"></script>
  <script src="/scripts/masonryScripts.js"></script>
  
  {{#if currentUser}}
    {{> dynamicBar}}
    {{> sidebar}}
  {{/if}}
  {{> Template.dynamic template=main}}
</template>

Any help would be gret :slight_smile:

If you are using non-dynamic scripts, like masonry, you should probably put them in the client/compatibility folder, per the docs.

If you are pulling scripts from a CDN, and those scripts are vital to the app, I’d probably do something like:

// client/startup.js
Meteor.startup(() => {
  $.getScript('http://somescript.com/script.js', () => {
    console.log('script loaded');
  });
});

You should really try to avoid using the script tags if at all possible.

Thanks, let me try with your code :wink: