From feb37f5812f981a625aa33cd11a8ee0e4bfefe73 Mon Sep 17 00:00:00 2001 From: Emi Simpson Date: Fri, 6 Dec 2019 19:27:41 -0500 Subject: [PATCH] Added support for lazy loaded images Note: The way this patch works is by resolving any data-src tags on images in the same way as normal source tags are resolved. It is assumed that most lazy-load libraries will use this tag, and that if this tag is set, then it is a URL that is in use. --- src/html.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/html.rs b/src/html.rs index 3c7057f..3756e46 100644 --- a/src/html.rs +++ b/src/html.rs @@ -158,7 +158,7 @@ pub fn walk_and_embed_assets( } "img" => { for attr in attrs_mut.iter_mut() { - if &attr.name.local == "src" { + if &attr.name.local == "src" || &attr.name.local == "data-src" { let value = attr.value.to_string(); // Ignore images with empty source