File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ module.exports = function (options) {
2020 return function posthtmlWebp ( tree ) {
2121 tree . match ( [ { tag : 'img' } , { tag : 'amp-img' } ] , function ( imgNode ) {
2222 if ( imgNode . skip ) return imgNode
23- var classes = imgNode . attrs && imgNode . attrs . class && ( imgNode . attrs . class . split ( ' ' ) || [ ] )
23+ var classes = ( imgNode . attrs && imgNode . attrs . class && imgNode . attrs . class . split ( ' ' ) ) || [ ]
2424 var extension = imgNode . attrs . src . split ( '.' ) . pop ( )
2525 var isIgnoredByClass = options . classIgnore . filter ( className => classes . includes ( className ) ) . length > 0
2626 var isIgnoredByExtension = options . extensionIgnore . filter ( fileExtension => fileExtension === extension ) . length > 0
Original file line number Diff line number Diff line change 11<!doctype html>
22< html >
3- < body >
4- < img class ="ignore-class " srcset ="photo-lg.jpg 1000w, photo-md.jpg 500w, photo-sm.jpg 250w " src ="photo.png ">
5- </ body >
3+ < body >
4+ < img class ="ignore-class " srcset ="photo-lg.jpg 1000w, photo-md.jpg 500w, photo-sm.jpg 250w " src ="photo.png ">
5+ < picture > < source type ="image/webp " srcset ="photo.png.webp "> < img src ="photo.png "> </ picture >
6+ </ body >
67</ html >
Original file line number Diff line number Diff line change 11<!doctype html>
22< html >
3- < body >
4- < img class ="ignore-class " srcset ="photo-lg.jpg 1000w, photo-md.jpg 500w, photo-sm.jpg 250w " src ="photo.png ">
5- </ body >
3+ < body >
4+ < img class ="ignore-class " srcset ="photo-lg.jpg 1000w, photo-md.jpg 500w, photo-sm.jpg 250w " src ="photo.png ">
5+ < img src ="photo.png ">
6+ </ body >
67</ html >
You can’t perform that action at this time.
0 commit comments