CSS file count is reasonable

medium

css_file_count

Checks that the number of CSS files is reasonable.

What does this rule check?

Multiple CSS files add HTTP request overhead and can delay rendering. Consolidating stylesheets reduces load time and simplifies cache management.

Why is this important?

Each CSS file is render-blocking by default. Multiple CSS files compound this problem, delaying First Contentful Paint.

How to fix

Bundle CSS files into fewer files. Inline critical CSS. Lazy-load non-critical stylesheets.

Examples

Incorrect
<!-- 10 separate CSS files -->
<link rel="stylesheet" href="reset.css" />
<link rel="stylesheet" href="layout.css" />
...
Correct
<!-- 1-2 bundled CSS files -->
<style>/* Critical CSS inlined */</style>
<link rel="stylesheet" href="styles.css" />

Agent fix snippet

Copy this snippet and paste it into your AI coding agent to fix this issue automatically.

Reduce CSS file count:
1. Bundle CSS with your build tool
2. Inline critical above-fold CSS
3. Remove unused CSS references
4. Use CSS-in-JS or scoped styles