URL: /rules/perf/css-file-size

---
title: "CSS File Size Too Large"
description: "Checks for CSS files that exceed recommended size limits"
---

Checks for CSS files that exceed recommended size limits

| | |
|---|---|
| **Rule ID** | `perf/css-file-size` |
| **Category** | [Performance](/rules/perf) |
| **Scope** | Site-wide |
| **Severity** | error |
| **Weight** | 6/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:

| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `warn_bytes` | number | `153600` (150KB) | Byte size to trigger warning |
| `error_bytes` | number | `512000` (500KB) | Byte size to trigger error |

### Configuration Example

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

## Enable / Disable

### Disable this rule

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

### Disable all Performance rules

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

### Enable only this rule

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