ParserBlockingScriptTag

Version 0.9.0+

The script_tag filter emits a parser-blocking script tag.

Use an <script src="..." defer> or <script src="..." async> element instead.

Learn more about improving your theme's performance.

Examples

Below are examples of code that fails and passes this check.

✗ Fail

The script_tag filter in the example below outputs a parser-blocking script.

✓ Pass

{% raw %} This example uses the asset_url filter with a defer attribute on the HTML script tag.

This example uses the asset_url filter with a async attribute on the HTML script tag.

Disabling this check

If you can't avoid violating the rule, you should disable the check using the comment syntax. This ensures that you intentionally disable the check for each instance.

Disabling this check isn't recommended.

{% raw %}