Most of us probably know about the most common way to add a CSS file to the panel:
I needed to add multiple CSS files to my panel, one from a plugin and one from another plugin. I’m already using the
set feature so it felt natural to use it here as well.
In a plugin I added this:
kirby()->set('option', 'panel.stylesheet', array( 'assets/plugins/my-plugin/css/panel.css', 'assets/css/panel.css' ));
kirby()->set()to register the
- Adding an array with file urls.
I was surpriced that both changes work, especially multiple CSS files as I did not find any info about it in the docs.
Why multiple CSS files
Let’s say there are two great plugins out there that both has a
panel.css file. You don’t want to hack the core any these plugins. Instead you can make the third plugin that just set the panel css files. The benefit is when the other two plugins are updated. If they are updated with new CSS code it will just work.
Maybe not everyone will have this case, but I did and it’s great that it just works!