meom-blocks v0.1.0
What is this tool all about?
This toolset is used to create new blocks into Wordpress instance using existing templates as a starting point. Toolset can also be used to manage and create block templates and block catalogs that are housing templates.
The purpose of block templates is to make new block creation simpler, more consistent and to reduce need for copy-paste between projects when working with generic blocks that need only little project specific tweaking.
Example: Creating new block from template
How to add MEOM Blocks into WP-project.
Before using MEOM-Blocks in Wordpress project some initializations has to be made. Next steps need to be done only once, preferably at the same time as other setup when creating a new project.
1. Add plugin into the project using composer.
- TODO
2. Define what block catalog should be used in the project.
Before using the tool for the first time in the project, you must configure what block catalog you want to use and where it can be found. It is strongly recommended to use these configurations on project basis, using .npmrc
configuration file. This file should be committed to project repository during the setup along with other files.
Execute following command on project root to generate configurations (replace ):
echo 'block_catalog=git@<address>.git' > .npmrc
See section "Block Catalog" for instructions on how to create and manage block catalog.
How to use the tool
Block catalog
Private / public block catalog can be hosted on the preferred VC as long as it is a clonable git repository.
Before creating new blocks with this tool you must already have existing block catalog in which the new block is being created. Block catalog is a Wordpress plugin that is housing block templates, editor controls, universal styles and helpers.
Block catalog and it's contents are stored in it's own repository. It can be easily kept up to date in separate projects by using composer to take care of new updates.
New block catalog can be created by using following command:
npx create-meom-catalog my-catalog
How to use block catalog
Start by creating new template block in to the block catalog using scaffolding tool. Run the following command in block catalog root directory:
npx create-meom-block my-block
This command will create the following file structure inside block catalog:
└── blocks
└── my-block
└── block-styles.scss
└── editor-styles.scss
└── settings.json
└── views.hbs
5 years ago