Skip to main content
Version: 0.1.x

SALVO-TS Preprocessor

The SALVO-TS preprocessor is an experimental feature which introduces new tags that are evaluateda at compile time, outside of liquid.

Shortcomings

Currently the preprocessor is implemented as a set of fairly primitive regexes - this means there is no syntax checking/error reporting and that the tags themselves are fairly limited.

Available tags

Shorthand

You can create comments using Twig-like shorthand syntax:

{# This is a comment! #}
Equivalent to:
{% comment %}This is a comment!{% endcomment %}
Outputs: (nothing)
{# This is a comment! #}
Equivalent to:
{% comment %}This is a comment!{% endcomment %}
Outputs: (nothing)
tip

Put your editor into Twig language mode for better syntax highlighting with shorthand comments

|e filter
TBD

You can escape content using the |escape filter using shorthand filter syntax:

{{ 'This will be <b>escaped</b>' | e }}
Equivalent to:
{{ 'This will be <b>escaped</b>' | escape }}
Outputs:
This will be <b>escaped</b>
{{ 'This will be <b>escaped</b>' | e }}
Equivalent to:
{{ 'This will be <b>escaped</b>' | escape }}
Outputs:
This will be <b>escaped</b>

{{ '{{' }}{ Escape }}} tag
TBD

You can escape content using the |escape filter using shorthand tag syntax:

{{{ 'This will be <b>escaped</b>' }}}
Equivalent to:
{{ 'This will be <b>escaped</b>' | escape }}
Outputs:
This will be <b>escaped</b>
{{{ 'This will be <b>escaped</b>' }}}
Equivalent to:
{{ 'This will be <b>escaped</b>' | escape }}
Outputs:
This will be <b>escaped</b>

{! component !} tag

TODO

{! schema_block !} tag

Import reusable blocks of schema into your sections:

// static/sections/schema_blocks/example.json
{
"type": "header",
"content": "Example header",
}
// static/sections/schema_blocks/example.json
{
"type": "header",
"content": "Example header",
}
// static/sections/mysection.liquid
{% schema %}
{
"name": "Register",
"settings": [
{! schema_block 'example' !},
{
"type": "text",
"id": "title",
"label": "Title",
"default": "WHY REGISTER?"
},
]
}
{% endschema %}
// static/sections/mysection.liquid
{% schema %}
{
"name": "Register",
"settings": [
{! schema_block 'example' !},
{
"type": "text",
"id": "title",
"label": "Title",
"default": "WHY REGISTER?"
},
]
}
{% endschema %}
tip

Remember to put a comma at the end of the schema_block tag! Don't put a comma at the end of the schama block snippet itself (this would prevent you from using it at the end of a schema)