Documentation Index
Fetch the complete documentation index at: https://platform.docs.zenoo.com/llms.txt
Use this file to discover all available pages before exploring further.
YAML
The YAML used in Target Builder is a standard YAML that has been extended with some specific YAML tags. For initial acquaintance with the YAML read this article: Learn X in Y minutes (Where X=yaml)Reserved fields
In the YAML files, there are three “reserved” fields in the root:~private
- It can be used to store data, which will be omited in build time, and will not be in target configuration. This field is processed by target-builder.
Example
List of supported tags
Compile-time tags
Run-time tags
Deprecated tags
!include compile-time tag
- This tag is used to import/include any type of file into this place of YAML.
- This tag supports properties, which correspond to the parameters of this file.
- This tag internally opens any file as string, then processes by EJS (https://ejs.co), and then it passes the contents as a string (for other types) — or processes it by compiler if it is a supported file type (YAML, MD, HTML, LESS).
- You can use EJS for any kind of modifing file that depends on properties, such as—for example-generating some repeating parts of a document or setting values for some of the properties.
- The tag is always processed immediately when is used, except when it is used in the
componentsfield in root of YAML file (see !ref). - The tag is used for including any type of file—not only for YAML but also for LESS, CSS, MD, HTML, etc.
- When you attempt to include a directory, the Target builder will look in this directory for the
index.yamlorindex.ymlfile. It will include this file if it is found. Keep in mind that you can include components like!include ./components/buttoninstead of!include ./components/button/index.yml).
Syntax
Short version (without properties):Examples
!ref compile-time tag
- This tag is used to reference some component into this place
- The source for the components is the
componentsfield in the root of YAML file. - This tag can have properties that the same as the !include tag
- The !ref tag properties have higher priority than !include properties in
componentsfield - You can make multiple references to a component, with different properties for each reference.
Syntax
Examples
!property compile-time tag
- This tag is useful as a placeholder for the value of a propertys (in an !include of a YAML file.
- While it is possible to use EJS for this, EJS only works with a string. It’s not possible to pass some array or object using EJS, and this is the purpose of the !property tag.
-This tag can have
defaultvalue (only in the long version), which can contain any valid YAML value—including a string, number, array, or complex object. - This tag can have
required: truemark (only in long version), which will throw an error message while build target, when value is not filled (defaultvalue don’t have any impact ifrequired: trueis set). - If the property is not set, this tag is set to
undefined, and field will not appear in the output JSON.
Syntax
Short version (without default):Examples
!condition compile-time tag
- This tag is for removing or including some parts of YAML structure (in an !include of a YAML file).
- The first parameter (key) can be either
includeoromit.includeleaves the bject in the structure if the expression is a genuine value.omitremoves the object from the structure if the expression is a genuine truly value. - The second parameter (expression) is the expression in EJS format.
- This tag is valid only for object types and include/omit object in which is contained. (It is not permissible to apply this tag to a string or number value; use EJS isntead.)
Syntax
Examples
!component run time tag
- This tag creates a component in hub-client-core. During execution, it is converted into a real React component in the HTML DOM.
- Every element is created by
React.createElement, and property items will be used as children. - The parameter is name of hub-client-core component, or any React Element such as div, span, h1, etc.
Syntax
Examples
!repeat run time tag
- This tag creates a repeat snippet in the hub-client-core. At execution, this is evaluated in React.
- The parameter is any array (static or from !expression). For more information about the repeat snippet, see the hub-client-core documentation.
Syntax
Examples
n times (n is length of array).
Inside the component, you can access an item by expression that is stored in the key. In the expression, you can directly access an item of the array ([key].item) or its index ([key].index).
This is the format:
!expression run time tag
- this tag creates an expression in hub-client-core. At execution, this is evaluated in React.
- The parameter is an expression. For more information about expressions, see the hub-client-core documentation.
Syntax
Short version (without parameters):Examples
!function run time tag
- This tag creates a JS function in hub-client-core. At execution time, it evaluated in React and may be used as a paramater in the events of components.
- The parameter is a function body. For more info about expressions, see the hub-client-core documentation.
Syntax
Short version (without parameters):Examples
!t run time tag
- This tag creates a translated string in hub-client-core. At execution time, it evaluated in React.
- The long version of this tag provides parameters. The first parameter is replaced with the second parameter.
Syntax
Short version (without params):Examples
!cx run time tag
- This tag is shorcut for a
cx(...)method call in hub-client-core expressions. - The parameter must be array of classnames (after
args).