I’ve been trying to add a responsive menu (Responsive Nav ) to my website, but fail to make it work.
My browser is notifying of following errors:
[Error] Failed to load resource: the server responded with a status of 404 (Not Found)
https://www.mysite.com/kirby/responsive-nav.js
[Error] Failed to load resource: the server responded with a status of 404 (Not Found)
https://www.mysite.com/kirby/responsive-nav.css
ReferenceError: Can't find variable: responsiveNav
I have followed the usage instructions presented in the plugin’s GitHub-page and I have tried different ways to place the assets including the one suggested in the Kirby documentation (https://getkirby.com/docs/developer-guide/plugins/assets):
Plugin assets is not the right place, it’s only for Kirby plugins, not for Javascript stuff. You should put your files into assets/js and then include the link tag for the js and css files between the <head></head> tags in the header snippet.
For easier referencing, you can use thecss() and js() helpers.
For example, if the file responsive-nav.min.js is located in /assets/js/responsive-nav/responsive-nav.min.js
Your plugin users can customize your stylesheets, images, or any other asset, by copying the orginal from the plugin’s asset folder to the actual asset location /assets/plugins/{pluginName} as pointed out by the URL. The server will then pick the custom file instead of running the route to the original plugin asset.