I’ve come up with a new really interesting workflow.
A normal structure
assets/css/product.css
assets/css/category.css
snippets/product.php
snippets/category.php
CSS files are grouped together in a the assets
folder. The snippet PHP files are grouped together in the snippets
folder.
Patterns structure
Kirby Patterns have a different structure:
patterns/products/product.css
patterns/products/products.html.php
patterns/category/category.css
patterns/category/category.html.php
Instead of grouping the files by type they are now grouped by “module”. Delete the category folder and all that has to do with the category is gone.
Bricks structure
I’ve now taken that approach one step ahead. Instead of just having the snippets as patterns I felt the need for grouping even more stuff.
bricks/product/style.css
bricks/product/blueprint.yml
bricks/product/controller.php
bricks/product/template.php
bricks/product/snippets/tags/tags.css
bricks/product/snippets/tags/tags.php
bricks/category/routes.php
bricks/category/style.css
bricks/category/blueprint.yml
bricks/category/controller.php
bricks/category/template.php
bricks/category/hooks.php
It was similar to the approach I had for making plugins. I’ve started a plugin called “Kirby Bricks” which automatically register the files and folders it finds with the matching files.
Benefits:
- Kirby is now truly modular.
- Delete a brick and everything, I really mean everything about that brick will be gone.
- The file structure will be really flat, all in one place. There is almost only
plugins
andbricks
left. - I don’t work with for example all the blueprints at the same time. I work with a “brick” a part that contains blueprint, controller and template. I now have access to all the important files directly.
- It’s easier to spot things that are no longer needed.
- It reminds about plugins, but it’s really modules/bricks of your site.
What do you think?