add-slot
Learn how to add slots to a project.
This action adds slots to the project, equivalent to the croct add slot command.
A common pattern is to run it after create-resource to register the slots that were just provisioned in the workspace.
Example
The following template creates an announcement bar component and slot in the workspace, then registers the slot in the project:
template.json5
{ "$schema": "https://schema.croct.com/json/v1/template.json", "title": "Announcement bar", "description": "Creates and adds an announcement bar slot.", "actions": [ { "name": "create-resource", "resources": { "components": { "top-bar": { "name": "Top bar", "schema": { "type": "structure", "attributes": { "message": { "type": { "type": "text" }, "label": "Message", "position": 0 } } } } }, "slots": { "announcement-bar": { "name": "Announcement bar", "component": "top-bar", "content": { "en": { "type": "structure", "attributes": { "message": { "type": "text", "value": { "type": "static", "value": "Welcome to our site!" } } } } } } } } }, { "name": "add-slot", "slots": ["announcement-bar"], "example": true } ]}Properties
These are the supported properties:
- namestring
The action identifier. Always add-slot for this action.
- slotsArray<string>
The list of slots to add.
Each entry can be in the format id or id@version. When the version is omitted, the latest version is used.
- example(optional)boolean
Whether to generate example usage code for the added slots in the examples path.