I want to use a jQuery script on my projects template. Do I need to include the library like
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script> in my header or is it already included by Kirbys core?
Kirbys developer put a lot of work in keeping it lightweight. Do I really need to load an external library just for one little script?
And where do I store my jQuery Code? As a .js file in the assets folder?
jQuery is not included in the Kirby core. You can use the
js() helper to include it (or use the standard script tag).
Ok, thanks! Just a quick follow up question: I put my jQuery script in the controllers folder – But what are plugins for?
If I were in your place, I would put the js-file (jQuery script) in the new folder “
Plugins are extensions to the default Kirby functionality; they can in fact be anything from a file with some php helper functions, to a complete new templating engine, https://getkirby.com/docs/developer-guide/plugins
The controller folder is intended for, well, controllers, that help you to separate logic from your HTML in the templates. You should not put anything but controllers in there.