---
title: StylesheetOncePerFile
description: Identifies files that contain more than one stylesheet tag.
source_url:
  html: >-
    https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/stylesheet-once-per-file
  md: >-
    https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/stylesheet-once-per-file.md
api_name: liquid
---

# StylesheetOncePerFile

Identifies files that contain more than one `{% stylesheet %}` tag. Theme Check reports the second and later stylesheet tags because `{% stylesheet %}` can appear only once per file.

Each section, block, or snippet file should keep its CSS in a single stylesheet tag. To learn how Shopify bundles this CSS, refer to [JavaScript and stylesheet tags](https://shopify.dev/docs/storefronts/themes/best-practices/javascript-and-stylesheet-tags#stylesheet).

***

## Examples

The following examples contain code snippets that either fail or pass this check.

### ✗ Fail

In the following example, `sections/hero.liquid` contains two `{% stylesheet %}` tags:

```liquid
{% stylesheet %}
.hero {
  display: grid;
}
{% endstylesheet %}


{% stylesheet %}
.hero__title {
  margin-block: 0;
}
{% endstylesheet %}
```

### ✓ Pass

In the following example, `sections/hero.liquid` contains one `{% stylesheet %}` tag:

```liquid
{% stylesheet %}
.hero {
  display: grid;
}


.hero__title {
  margin-block: 0;
}
{% endstylesheet %}
```

***

## Options

The following example contains the default configuration for this check:

```yaml
StylesheetOncePerFile:
  enabled: true
  severity: error
```

| Parameter | Description |
| - | - |
| `enabled` | Whether this check is enabled. |
| `severity` | The [severity](https://shopify.dev/docs/storefronts/themes/tools/theme-check/configuration#check-severity) of the check. |

***

## Disabling this check

Disabling this check isn't recommended. If you can't avoid violating the rule, then you should disable the check using the [comment syntax](https://shopify.dev/docs/storefronts/themes/tools/theme-check/configuration#disable-checks-using-liquid-comments). This ensures that you intentionally disable the check for each instance.

```liquid
{% # theme-check-disable StylesheetOncePerFile %}
{% stylesheet %}
.hero {
  display: grid;
}
{% endstylesheet %}


{% stylesheet %}
.hero__title {
  margin-block: 0;
}
{% endstylesheet %}
{% # theme-check-enable StylesheetOncePerFile %}
```

***
