amp-library
amp-library copied to clipboard
Using custom attribute 'data-src' from original img element when creating amp-img element.
Hi,
I am trying to use the attribute 'data-src' in my original img element as the 'src' attribute in the amp-img element. My original HTML img elements are setup like below to interact correctly with the https://github.com/aFarkas/lazysizes image lazy loading javascript plugin. A couple other lazyload plugins use the same attribute to manage the image source as well... 'data-src' value is what the 'src' value would normally be.
<img alt="alternate title" data-src="/uploads/XXXX.png" class="lazyload" />
I looked at the ImgTagTransformPass.php
file and saw that it references the 'src' attribute a couple times but am not sure where to start with getting amp-library to use 'data-src' for the final output 'src' (for img element). Does I need to edit the validator files in src/Spec
?
Could anyone please point me in the correct direction? Thanks.