Sha256: b9618b9650edba6a11238270032592c64bb477ca856fb8ef208f4ec913afbc8e
Contents?: true
Size: 499 Bytes
Versions: 19
Compression:
Stored size: 499 Bytes
Contents
# frozen_string_literal: true module PlatformosCheck 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:) end end end
Version data entries
19 entries across 19 versions & 1 rubygems