Kirby JS helper issue

I have an issue with the JS helper:

<?php echo js('@auto') ?>

It only loads the correct javascript if it is placed inside the head html tag. I wan’t to place this in the footer for performance reasons, but when i do that it loads the js file for the home page on every page of the site instead of the one corresponding the to the page template. Is this intentional (can’t think why!) or a bug?

Thanks.

I can’t reproduce this issue, I’m afraid. Sure that your filenames are correct?

I have just figured out the cause. By placing the tag in different parts of the page and reloading to see where the filename changes, i isolated the problem.

If you use this tag after a call to the Panelbar plugin, it confuses the loader. :frowning:

Seems Panelbar messes with the “context” some internal variable of the page if you get what i mean, which caused the autoloader not to see the real page template.

This breaks the loader:

<?php snippet('plugin.panelBar') ?>
<?php echo js('@auto') ?>

I still can’t reproduce this even with the Panelbar installed, have you added any custom extensions to the plugin?

Is there any way to reproduce this? Maybe you should open an issue in the Panelbar repo.

Please do and I’ll have a look at it as well.

I should point out that i’m using the dev branch version of Panelbar becuase it contains a fix to another issue @distantnative fixed the other week.

I’ll post the problem on the repo.

@distantnative @texnixe Thanks for your help… Github Issue Opened

1 Like