Skip to content

Directives¤

Overview¤

Note

SP-Lang directives are expanded during compilation. They are not expressions.

  • !INCLUDE: Inserts the content of another file.

!INCLUDE¤

Insert the content of another file.

Type: Scalar, Directive.

The !INCLUDE directive is used to paste a content of given file into current file. If included file is not found, SP-Lang renders error.

Synopsis:

!INCLUDE <filename>

The filename is a name of the file in the library to be included.

It could be:

  • an absolute path, starting with / from the root of the library,
  • an relative path to the location of the file containing !INCLUDE statement

.yaml extension is optional and will be added to the filename if missing.

Example

This is a simple inclusion of the other_file.yaml:

!INCLUDE other_file.yaml

Example

In this example, !INCLUDE is used to decompose a larger expression into a logically separated files:

!MATCH
what: !GET {...}
with:
  'group1': !INCLUDE inc_group1
  'group2': !INCLUDE inc_group2