Sha256: 5568ce8fdb217d726437682dae68ed86e271fda8ec82bad28d79a3d31b033739

Contents?: true

Size: 1.46 KB

Versions: 33

Compression:

Stored size: 1.46 KB

Contents

# Discourage use of parser-blocking `script_tag` filter (`ParserBlockingScriptTag`)

The `script_tag` filter emits a parser-blocking script tag.

See the [ParserBlockingJavaScript check documentation][parser_blocking_javascript] for why this is generally discouraged.

## Check Details

This check is aimed at eliminating parser-blocking JavaScript on themes.

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

```liquid
<!-- The script_tag filter outputs a parser-blocking script -->
{{ 'app-code.js' | asset_url | script_tag }}
```

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

```liquid
<!-- Good. Using the asset_url filter + defer -->
<script src="{{ 'theme.js' | asset_url }}" defer></script>

<!-- Also good. Using the asset_url filter + async -->
<script src="{{ 'theme.js' | asset_url }}" async></script>
```

## Check Options

The default configuration for this check is the following:

```yaml
ParserBlockingScriptTag:
  enabled: true
```

## When Not To Use It

This should only be turned off with the `theme-check-disable` comment when there's no better way to accomplish what you're doing than with a parser-blocking script.

It is discouraged to turn this rule off.

## Version

This check has been introduced in Theme Check 0.9.0.

## Resources

- [ParserBlockingJavaScript check][parser_blocking_javascript]
- [Documentation Source][docsource]

[parser_blocking_javascript]: /docs/checks/parser_blocking_javascript.md
[docsource]: /docs/checks/parser_blocking_script_tag.md

Version data entries

33 entries across 33 versions & 1 rubygems

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