Sha256: a15da54d7ce50207cba5b4b7407114938f5eb7ba7d12cfe76dc02e185cee64b3
Contents?: true
Size: 497 Bytes
Versions: 1
Compression:
Stored size: 497 Bytes
Contents
# frozen_string_literal: true module ThemeCheck class ImgLazyLoading < HtmlCheck severity :suggestion categories :html, :performance doc docs_url(__FILE__) ACCEPTED_LOADING_VALUES = %w[lazy eager] def on_img(node) loading = node.attributes["loading"]&.downcase return if ACCEPTED_LOADING_VALUES.include?(loading) add_offense("Use loading=\"eager\" for images visible in the viewport on load and loading=\"lazy\" for others", node: node) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
theme-check-1.15.0 | lib/theme_check/checks/img_lazy_loading.rb |