Twig Tools by Basalt
composer require basaltinc/twig-toolsTakes the path to a .json, .yml, or .yaml file and returns the data for use in Twig.
path{string} Either absolute path, relative path from CWD, or Twig Namespace path like@namespace/file.json.
{% set schema = get_data('@namespace/foobar.schema.yml') %}Takes the path to a .json, .yml, or .yaml data schema file and validates the data being used by the twig template file in which the validate function is included. As a standard, this should be the last thing included in a twig template file.
path{string} Either absolute path, relative path from CWD, or Twig Namespace path like@bolt-components-foo/foo.schema.json.
{{ validate_data_schema('@namesapce/foobar.schema.yml', _self) }}Outputs data to the browser's console log.
dataAny data you would like to log to the console from a twig template.
{{ console_log(page.meta) }}