Best way to reuse code between projects

I’m looking for ideas and strategies that can be used to speed up development so creating a brand new Kirby site takes less and less time with each client project completed.

I want the websites to share as much code as possible so I can update all of the websites at once without stuff breaking while keeping custom features from being overwritten.

This would be similar to WordPress’s parent and child theme functionality.

Should I create my own theme as a plugin?

How do you approach code reusability and reducing maintenance with your own client projects?

2 Likes

I have:

Most of the time in the progress of building a site, I have less and less code that I can share between projects, and if so, I’ll mostly copy and paste afterward.

Summary: Heavily make use of the plugin feature for stuff that you can re-use, and create a good starter/plainkit that includes the defaults you need for every project.

I do pretty much the same thing. I have a custom starter kit and a custom plugin with functions I use every project. Those are mostly helper functions for small things I do over and over again.

Other than that, I rewrite pretty much everything from scratch everytime and that’s because I learn something new with each project and so I prefer to put my improved skills to use on the next site I code.

Since I use kirby to code custom websites there’s not much code reusability in general.

1 Like

Coming from a front-end POV , I reuse a lot of css and js. In the past I have used Codekit’s “framework” feature which points to a folder on your machine. You define anything in a framework.

Now I’m leaning towards building a comprehensive startup script which will load all the dependencies and pull a git repo holding my base css and js files. Better. Integrates with external repos.