Is it possible to have a section/block schema in a separate file?

For more complex and customizable sections in my custom shopify theme the template files can become quite long (thousands of rows) and harder to work with, having to open the same file two times in parallel, commit changes separately, all in all I see no practical reason to have them in the same file (SoC, modularity and all).

So I’d like to put the {% schema %} in a separate *.json or *.json.liquid and maybe include it like you do with snippets and styles

{% schema %}
    {% render 'schema_name' %}
{% endschema %}

or

{% schema %}
    {{ 'schema_name.json' | asset_url }}
{% endschema %}

All the references I find are about how this was done in slate and how it’s done in jekyll liquid but nothing on whether this is currently possible in shopify or not, or at least that it’s definitely not possible or why or why not to do/want this.

Thanks!

Hi @zoltankundi ,

schema must contain JSON code within it, so any other functions including your examples will not be able to execute.

So this is not possible.

Refer https://shopify.dev/themes/architecture/sections/section-schema

Hope it helps!

Sad. Making a custom bundler just for this seems way overkill, but it’d be a nice feature.

It is possible if you have a little knowledge of Node.js and you’re using the Shopify CLI.
Check the solution here: Shopify Section / Block Schema In A Separate File. It is possible