Hi! While working with the blocks field and adding custom blocks to a plugin, I realised something, I don’t know how I missed it before.
Is it possible to add the whole website files in a plugin? Blueprints, models, controllers, collections, snippets, and templates?
The great benefit I see from this is I can have my Kirby website base in a plugin, and then on individual projects if I need additional functions I can override blueprints, controllers, snippets, etc in regular site files. And also when I update, improve and add features to my website base I just update the plugin, don’t run through files of every website.
If this is possible, and it seems so, are there any known negative consequences?
Thank you. Now, after I checked the documentation, I see there should be no issues.
Fantastic, this is just great.
This is a very interesting idea …essentially “Themes” for Kirby. Thanks for pointing this out, please report back with your experiences if you have a chance
1 Like
Yes, very interesting, especially for the plugin files override in the regular site folder. Easily extendible and maintainable.
And with the consistent blueprint field naming, at least for most used post types like default page, blog & articles, portfolio & projects, events & event, etc, theme changing is there.
We use this pattern a lot. We have developed a base plugin providing standard functionality most websites need, eg. a default site.yml, common fields, blocks and snippets.
For one client we run multiple websites with very similar functionality with one single base plugin providing 90% of the code all websites share and we only override some snippets and SCSS inside each site to adapt to the specific design of each site.
Both plugins are kept inside a separate repository and included via composer so i’ts easy to update them on each site.
This works extremely well. If you have any questions regarding this setup feel free to ask.
1 Like
Hi, @mactux, I’m glad to hear someone is using this approach already.
So far we didn’t find any issues, our desired setup is similar to yours, only instead of SCSS we use LESS. I was a bit concerned will it impact the performance, but so far I didn’t notice anything similar.
The only frustration I have is how we didn’t see this approach earlier. It has so many benefits.