Skip to main content

MaxFileSize

Identifies theme files that are larger than Shopify's maximum file size for their path. This check applies to Liquid, JSON, and asset files in size-limited theme directories, and ignores files in the _drafts directory.

Asset file limits use the full UTF-8 byte size. For non-asset file limits, Theme Check doesn't count bytes inside {% schema %} tags toward the file-size limit.


The following examples contain code snippets that either fail or pass this check.

In the following example, snippets/card.liquid exceeds the 256 KB limit for the snippets directory. The markup is abbreviated here:

snippets/card.liquid

<article class="card">
{{ product.title }}
{% comment %} Repeated markup totaling more than 256 KB {% endcomment %}
</article>

In the following example, an oversized JSON template is ignored because it's in the _drafts directory:

_drafts/templates/index.json

{
"sections": {
"main": {
"type": "main-product"
}
},
"order": ["main"]
}

The following example contains the default configuration for this check:

MaxFileSize:
enabled: true
severity: error
ParameterDescription
enabledWhether this check is enabled.
severityThe severity of the check.

The following file-size limits are enforced:

File pathLimit
assets20 MB
locales1.5 MB
config/settings_data.json1.5 MB
config/settings_schema.json512 KB
templates/*.json512 KB
sections/*.json512 KB
blocks256 KB
config256 KB
layout256 KB
snippets256 KB
templates256 KB
sections256 KB

Anchor to Disabling this checkDisabling this check

Disabling this check isn't recommended.


Was this page helpful?