We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c6073ba commit 433d79cCopy full SHA for 433d79c
1 file changed
lib/index.js
@@ -10,14 +10,14 @@ module.exports = function (options) {
10
}
11
12
return function posthtmlWebp (tree) {
13
- tree.match({ tag: 'img' }, function (imgNode) {
+ tree.match([{ tag: 'img' }, { tag: 'amp-img' }], function (imgNode) {
14
if (imgNode.skip) return imgNode
15
- return getPicture(imgNode, options)
16
- })
17
-
18
- tree.match({ tag: 'amp-img' }, function (imgNode) {
19
- if (imgNode.skip) return imgNode
20
- return getAmpPicture(imgNode, options)
+ switch (imgNode.tag) {
+ case 'amp-img':
+ return getAmpPicture(imgNode, options)
+ default:
+ return getPicture(imgNode, options)
+ }
21
})
22
23
return tree
0 commit comments