Class: ThemeCheck::ParserBlockingScriptTag
- Inherits:
-
LiquidCheck
- Object
- Check
- LiquidCheck
- ThemeCheck::ParserBlockingScriptTag
- Defined in:
- lib/theme_check/checks/parser_blocking_script_tag.rb
Overview
Reports errors when trying to use parser-blocking script tags
Constant Summary
Constants inherited from Check
Check::CATEGORIES, Check::SEVERITIES
Instance Attribute Summary
Attributes inherited from Check
#ignored_patterns, #offenses, #options, #theme
Instance Method Summary collapse
Methods included from ChecksTracking
Methods included from ParsingHelpers
Methods inherited from Check
#==, #add_offense, all, can_disable, #can_disable?, #categories, categories, category, #code_name, #doc, doc, docs_url, #ignore!, #ignored?, #severity, severity, single_file, #single_file?, #to_s, #whole_theme?
Methods included from JsonHelpers
Instance Method Details
#on_variable(node) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/theme_check/checks/parser_blocking_script_tag.rb', line 9 def on_variable(node) used_filters = node.value.filters.map { |name, *_rest| name } if used_filters.include?("script_tag") add_offense( "The script_tag filter is parser-blocking. Use a script tag with the async or defer " \ "attribute for better performance", node: node ) end end |