Skip to content

04 Why an ID for every example?

JuanMa edited this page May 14, 2024 · 3 revisions

IDs are a great way to provide structure to this monorepo. It simplifies naming and referencing examples while it smooth the experience of locating plugins and blocks inside WordPress installations.

Locating plugins and blocks in WP installations

If you install several plugin examples in a WordPress installation it's easier to locate them by their ID to activate/deactivate them.

Blocks can also be located through their ID, so when you want to insert a specific block example, just search the block in the inserter by using its ID.

Naming of each example

Naming each example gets easier by providing an ID to each example as it avoids collision between them.

Scalability of the project

Having an ID per example allows this project to scale while keeping a good experience locating and referencing the examples. It won't matter if there are 10 or 100 examples as every example is easily located by their unique ID

Filters in the monorepo

Through pmpm we can filter commands for especific examples per ID as explained here