URL: /rules/perf/unminified-css

---
title: "Unminified CSS"
description: "Detects unminified CSS that could be optimized"
---

Detects unminified CSS that could be optimized

| | |
|---|---|
| **Rule ID** | `perf/unminified-css` |
| **Category** | [Performance](/rules/perf) |
| **Scope** | Per-page |
| **Severity** | warning |
| **Weight** | 4/10 |

## Solution

Minify CSS to reduce file size and improve load times. Use build tools like cssnano, clean-css, or PostCSS with cssnano plugin. Most bundlers (Webpack, Vite, esbuild) can minify CSS automatically in production mode. Minification removes whitespace, comments, and optimizes syntax.

## Options

This rule supports the following configuration options:

| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `min_size_bytes` | unknown | `undefined` | Minimum CSS size in bytes to check for minification |
| `newline_ratio_threshold` | unknown | `undefined` | Newlines per character ratio threshold for unminified detection |

### Configuration Example

```toml squirrel.toml
[rules."perf/unminified-css"]
min_size_bytes = undefined
newline_ratio_threshold = undefined
```

## Enable / Disable

### Disable this rule

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

### Disable all Performance rules

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

### Enable only this rule

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