Skip to content
This repository has been archived by the owner on Jul 27, 2024. It is now read-only.

Latest commit

 

History

History
52 lines (34 loc) · 1.33 KB

asset_size_css.md

File metadata and controls

52 lines (34 loc) · 1.33 KB

Prevent Large CSS bundles (AssetSizeCSS)

This rule exists to prevent large CSS bundles (for speed).

Check Details

This rule disallows the use of too much CSS in themes, as configured by threshold_in_bytes.

👎 Examples of incorrect code for this check:

<!-- Here, assets/theme.css is **greater** than `threshold_in_bytes` compressed. -->
{{ 'theme.css' | asset_url | stylesheet_tag }}

👍 Example of correct code for this check:

<!-- Here, assets/theme.css is **less** than `threshold_in_bytes` compressed. -->
{{ 'theme.css' | asset_url | stylesheet_tag }}

Check Options

The default configuration is the following.

AssetSizeCSS:
  enabled: false
  threshold_in_bytes: 100_000

threshold_in_bytes

The threshold_in_bytes option (default: 100_000) determines the maximum allowed compressed size in bytes that a single CSS file can take.

This includes theme and remote stylesheets.

When Not To Use It

This rule is safe to disable.

Version

This check has been introduced in Theme Check 0.6.0.

Resources