☁️ Loving our new documentation website? Provide feedback in the CloudCannon Community! ✨

_snippets_from_glob

Table of contents

Description:

This key defines globs that filter which files CloudCannon should use for Snippet configuration.

Values in this array are relative to the root of your repository (i.e., /, not the value of source) and must end in the file extension .cloudcannon.snippets.yml.

You can use this key anywhere you would use the _snippets key in the configuration cascade.

This key has no default.

Type:
Array<_snippets_from_glob[*]>
Items:
[*]string#

This key represents an individual glob pattern string in the _snippets_from_glob array.

The value is a string that specifies a file path pattern relative to the root of your repository. The path must end in the file extension .cloudcannon.snippets.yml.

Show examplesHide examples

In this example, each Custom Snippet has its own Configuration File in the .cloudcannon/snippets/ folder. The value of the _snippets_from_glob key tells CloudCannon to use the callout.cloudcannon.snippets.yml file in that folder.

Copied to clipboard
_snippets_imports:
  eleventy_liquid: true
_snippets_from_glob:
  - /.cloudcannon/snippets/callout.cloudcannon.snippets.yml
{
  "_snippets_imports": {
    "eleventy_liquid": true
  },
  "_snippets_from_glob": [
    "/.cloudcannon/snippets/callout.cloudcannon.snippets.yml"
  ]
}
Examples:

In this example, each Custom Snippet has its own Configuration File in the .cloudcannon/snippets/ folder. The value of the _snippets_from_glob key tells CloudCannon to use the callout.cloudcannon.snippets.yml file in that folder.

Copied to clipboard
_snippets_imports:
  eleventy_liquid: true
_snippets_from_glob:
  - /.cloudcannon/snippets/callout.cloudcannon.snippets.yml
{
  "_snippets_imports": {
    "eleventy_liquid": true
  },
  "_snippets_from_glob": [
    "/.cloudcannon/snippets/callout.cloudcannon.snippets.yml"
  ]
}
Copied to clipboard
callout:
  template: eleventy_liquid_include
  inline: false
  preview:
    text: Callout
  definitions:
    include_name: callout
    named_args:
      - source_key: type
        editor_key: label
        type: string
      - editor_key: message
        type: string
  _inputs:
    label:
      type: select
      options:
        values:
          - info
          - warning
          - error
{
  "callout": {
    "template": "eleventy_liquid_include",
    "inline": false,
    "preview": {
      "text": "Callout"
    },
    "definitions": {
      "include_name": "callout",
      "named_args": [
        {
          "source_key": "type",
          "editor_key": "label",
          "type": "string"
        },
        {
          "editor_key": "message",
          "type": "string"
        }
      ]
    },
    "_inputs": {
      "label": {
        "type": "select",
        "options": {
          "values": [
            "info",
            "warning",
            "error"
          ]
        }
      }
    }
  }
}
Open in a new tab