Serve Icons and CSS in kirby module


I used my first time the Kirby Modulesplugin and now I’m standing for the problem to serve Icons for a simple Infobox.
I have an quickslect for the iconselection. With this I have no problem to get the images from the $page but I need it from $module.
Another solution was to use the $site to serve the images it in this I have also other images and so I don’ get served not only the Icons.

The other question is how can I integrate the module CSS-file which is stored in the corresponding modulefolder?


Well, doesn’t $module->whatever_the_icon_select_field_is_called()->toFile() work?


Edit: see my next post.

Hello Sonja,

regarding to the selectfield, I don’t mean the output of the module. I want to know how can I fill the imageselect in the panel with images from the modulesfolder? So that every module of this type has the same images in the select without uploading it first inside the module in the panel.

Regarding to the css question, ah okay. I thought there is an automatism inside the modulesplugin who is adding the css automatically if I have one.


No, at least not that I know if, and I don’t think it is such a good idea to add multiple CSS files anyway but rather combine them into a single file before they go into production.

Edit: Forget everything about the path to the CSS file. The modules folder is not in the plugins folder but in /site/modules, so it shouldn’t actually be accessible at all. You should move it or combine it with other files during your build process.

As regards images from the modules folder, such images wouldn’t or shouldn’t actually be directly accessible. Maybe you can create a media folder where you store images for the different modules.