Skip to main content
Checks for CSS files that exceed recommended size limits
Rule IDperf/css-file-size
CategoryPerformance
ScopeSite-wide
Severityerror
Weight6/10

Solution

Large CSS files slow down rendering and increase bandwidth. Split large stylesheets into smaller chunks, remove unused selectors, and minify CSS. Consider critical CSS inlining for above-the-fold styles and lazy-loading non-critical CSS.

Options

This rule supports the following configuration options:
OptionTypeDefaultDescription
warn_bytesnumber153600 (150KB)Byte size to trigger warning
error_bytesnumber512000 (500KB)Byte size to trigger error

Configuration Example

squirrel.toml
[rules."perf/css-file-size"]
warn_bytes = 153600
error_bytes = 512000

Enable / Disable

Disable this rule

squirrel.toml
[rules]
disable = ["perf/css-file-size"]

Disable all Performance rules

squirrel.toml
[rules]
disable = ["perf/*"]

Enable only this rule

squirrel.toml
[rules]
enable = ["perf/css-file-size"]
disable = ["*"]