Sha256: 6dfb6237779cca89dab69b5ada20d506817edf150ac2bce88cad76515476e098

Contents?: true

Size: 1.67 KB

Versions: 24

Compression:

Stored size: 1.67 KB

Contents

# Discourage the use of large template files (`TemplateLength`)

This check exists to discourage the use of large template files. Use snippets to componentize your theme.

## Check Details

This check is aimed at eliminating large template files.

:-1: Examples of **incorrect** code for this check:

- Files that have more lines than the threshold

:+1: Examples of **correct** code for this check:

- Files that have less lines than the threshold

## Check Options

The default configuration for this check is the following:

```yaml
TemplateLength:
  enabled: true
  max_length: 600
  exclude_schema: true
  exclude_stylesheet: true
  exclude_javascript: true
```

### `max_length`

The `max_length` (Default: `200`) option determines the maximum number of lines allowed inside a liquid file.

### `exclude_schema`

The `exclude_schema` (Default: `true`) option determines if the lines inside `{% schema %}` blocks from a template should be excluded from the line count.

### `exclude_stylesheet`

The `exclude_stylesheet` (Default: `true`) option determines if the lines inside `{% stylesheet %}` blocks from a template should be excluded from the line count.

### `exclude_javascript`

The `exclude_javascript` (Default: `true`) option determines if the lines inside `{% javascript %}` blocks from a template should be excluded from the line count.

## When Not To Use It

If you don't care about template lengths, then it's safe to disable this rule.

## Version

This check has been introduced in Theme Check 0.1.0.

## Resources

- [Rule Source][codesource]
- [Documentation Source][docsource]

[codesource]: /lib/theme_check/checks/template_length.rb
[docsource]: /docs/checks/template_length.md

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
theme-check-1.15.0 docs/checks/template_length.md
theme-check-1.14.0 docs/checks/template_length.md
theme-check-1.13.0 docs/checks/template_length.md
theme-check-1.12.1 docs/checks/template_length.md
theme-check-1.12.0 docs/checks/template_length.md
theme-check-1.11.0 docs/checks/template_length.md
theme-check-1.10.3 docs/checks/template_length.md
theme-check-1.10.2 docs/checks/template_length.md
theme-check-1.10.1 docs/checks/template_length.md
theme-check-1.10.0 docs/checks/template_length.md
theme-check-1.9.2 docs/checks/template_length.md
theme-check-1.9.1 docs/checks/template_length.md
theme-check-1.9.0 docs/checks/template_length.md
theme-check-1.8.0 docs/checks/template_length.md
theme-check-1.7.2 docs/checks/template_length.md
theme-check-1.7.1 docs/checks/template_length.md
theme-check-1.7.0 docs/checks/template_length.md
theme-check-1.6.2 docs/checks/template_length.md
theme-check-1.6.1 docs/checks/template_length.md
theme-check-1.6.0 docs/checks/template_length.md