Skip to main content

AssetSizeCSS

Prevents themes and theme app extensions from using CSS files larger than the configured threshold_in_bytes. Limiting the size of CSS files helps to improve the performance of your theme.


In the following example, the size of section-rich-text.css is checked to make sure that it doesn't exceed the specified threshold_in_bytes:

<link rel="stylesheet" href="{{ 'section-rich-text.css' | asset_url }}" media="print" onload="this.media='all'" />

The following example contains the default configuration for this check:

For themes:

AssetSizeCSS:
enabled: false
threshold_in_bytes: 100_000

For theme app extensions:

AssetSizeCSS:
enabled: false
severity: suggestion
threshold_in_bytes: 100_000
ParameterDescription
enabledWhether this check is enabled.
severityThe severity of the check.
threshold_in_bytesThe maximum allowed compressed size, in bytes, for a single CSS file. This includes the theme and remote stylesheets.

Anchor to Disabling this checkDisabling this check

This check is enabled by default when you run the Shopify CLI 3.x build command on a theme app extension. This limit is not yet enforced, but disabling this check isn't recommended for theme app extensions.

This check is disabled by default when you run the Shopify CLI 2.x shopify theme check command.


Was this page helpful?