Sha256: aa61ca7f4d3eb5868749111679ac5d9e86f200910f168c654e0de36753f31696

Contents?: true

Size: 707 Bytes

Versions: 6

Compression:

Stored size: 707 Bytes

Contents

# frozen_string_literal: true
module ThemeCheck
  class AssetPreload < HtmlCheck
    severity :suggestion
    categories :html, :performance
    doc docs_url(__FILE__)

    def on_link(node)
      return if node.attributes["rel"]&.downcase != "preload"
      case node.attributes["as"]&.downcase
      when "style"
        add_offense("For better performance, prefer using the preload argument of the stylesheet_tag filter", node: node)
      when "image"
        add_offense("For better performance, prefer using the preload argument of the image_tag filter", node: node)
      else
        add_offense("For better performance, prefer using the preload_tag filter", node: node)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
theme-check-1.15.0 lib/theme_check/checks/asset_preload.rb
theme-check-1.14.0 lib/theme_check/checks/asset_preload.rb
theme-check-1.13.0 lib/theme_check/checks/asset_preload.rb
theme-check-1.12.1 lib/theme_check/checks/asset_preload.rb
theme-check-1.12.0 lib/theme_check/checks/asset_preload.rb
theme-check-1.11.0 lib/theme_check/checks/asset_preload.rb