Using CLI for creating logic (Blocks, Single Pages, Packages)

Hi,

Perhaps this is already something ConcreteCMS is working on but I had an idea about using the ConcreteCMS CLI to create code. At the moment if i want to create a new block i need to start from scratch every time.
There is ofcourse the Block Designer you can buy but I’m thinking more about generating some sort of starting point (boiler template) for a Block, Single Page or Package without revisiting the docs for the standard setup or duplicating existing elements that you have to clean up/refactor.
But just simply run a command like c5:block create myCustomBlock with additional parameters to specify a location where to generate it for example.
Does anyone know if there is something like this on de roadmap or are there other people who think this would make development much faster?

Thanks

I always like this thinking, and in many frameworks there’s command to do ‘scaffolding’ of classes, views, etc.

I think the challenge here is that there’s still quite a lot of variables to building even something minimal like a new block, and if you’re going to build out a new block you’re likely to either copy something similar, or use one of the excellent block building packages.

A command line option to create a block in a package location or in the application folder could save a bit of time, but by itself it’s really only going to be a very lightweight class, a db.xml file without any fields, and some empty edit, add and view.php files. Whilst a little handy, that’s not really saving much time, whereas something to dial in a bunch of fields and outputs is arguably a lot more.

Block Designer is great, but I can also recommend Block Builder - Concrete CMS

That all being said, a command could still be useful, and I might not be considering the value high enough.

A command to create a new package could be handy, especially if it was interactive and asked a few questions about names, etc. I know that for new developers namespacing can often trip things up.

For themes, I’m not sure if this is boilerplate as such, but a while ago I put this together as a bit of a reference: GitHub - Mesuva/anatomy_theme: A highly commented, instructional example theme package for concrete5 v8

3 Likes

Great reference! Any plans for a v9 update? :see_no_evil:

I don’t believe there would be any changes to this for V9.
I’ve updated the description on the github repo to reflect this.

What about the new page theme features vs the old assets?

Good point, there’s functions like getThemeSupportedFeatures I haven’t referenced.

For CLI use, there is also Block Developer.

1 Like