Skip to content

Commit 433d79c

Browse files
committed
perf: process
1 parent c6073ba commit 433d79c

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

lib/index.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ module.exports = function (options) {
1010
}
1111

1212
return function posthtmlWebp (tree) {
13-
tree.match({ tag: 'img' }, function (imgNode) {
13+
tree.match([{ tag: 'img' }, { tag: 'amp-img' }], function (imgNode) {
1414
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)
15+
switch (imgNode.tag) {
16+
case 'amp-img':
17+
return getAmpPicture(imgNode, options)
18+
default:
19+
return getPicture(imgNode, options)
20+
}
2121
})
2222

2323
return tree

0 commit comments

Comments
 (0)