Multiple custom blocks in one plugin

Hi, is it possible to add multiple custom blocks in one plugin?
With blueprints, snippets, and previews altogether.

Yes, definitely!

Hi, @pixelijn, thank you very much for the fast response.

Can you, please, give me a code example of code structure?
I suppose the plugin’s index.php is doing the work of separating them, but I need some hints on how to do that properly.

So far I figured out how to add multiple previews in the plugin’s index.js.

Uh, sorry, I think I know, just didn’t test it. When I looked at this again Creating a custom block type from scratch | Kirby CMS it seems obvious.

The blueprints and snippets you would register like normal snippets, like here:

Then in your src index.js, you would import the different vue files

import Slider from './components/A.vue';
import Content from './components/B.vue';
import Divider from './components/C.vue';

panel.plugin("pixelijn/block-previews", {
  blocks: {
    a: A,
    b: B,
    c: C,
1 Like

Thank you very much, I will test it.

Working like a dream :muscle: