跳到主要內容

Compose Blocklets

What is Blocklet Composition?

What is Blocklet Composition?

To understad what is blocklet composition, please check out: Blocklet Composition

Compose in blocklet.yml

The blocklet.yml file allows you to define and compose multiple blocklets within your main blocklet. This feature enables you to create modular and reusable applications by incorporating other blocklets as components.

The components section in your blocklet.yml file is where you define the blocklets you want to include in your main blocklet. Here's the structure:

javascript
components:
  - name: did-comments
    mountPoint: /did-comments
    required: false
    source:
      store: https://store.blocklet.dev
      name: did-comments
      version: latest
  - name: meilisearch
    required: true
    mountPoint: /meilisearch
    source:
      store: https://dev.store.blocklet.dev
      name: meilisearch
      version: latest
  - name: payment-kit
    required: true
    source:
      store: https://store.blocklet.dev
      name: z2qaCNvKMv5GjouKdcDWexv6WqtHbpNPQDnAk
      version: latest

Fields Explanation:

  • name: required, The identifier for the component within your blocklet, should be DID for most cases
  • mountPoint: optional, The path where the component will be accessible in your blocklet.
  • required: optional, Boolean indicating whether the component is essential for your blocklet to function.
  • source: required: Specifies where to obtain the component blocklet.
    • store: URL of the blocklet store containing the component.
    • name: Name or DID of the blocklet in the store.
    • version: Version of the blocklet to use (e.g., "latest" or a specific version number).
    • url: if your blocklet is not hosted in any store, you can provide its bundle URL

To make blocklet composition much easier to accomplish, here are the steps:

Compose in Blocklet Studio