We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4fa4423 commit 735ed05Copy full SHA for 735ed05
1 file changed
lib/index.js
@@ -5,13 +5,20 @@ module.exports = function (options) {
5
options = {}
6
}
7
8
+ if (!options.classIgnore) {
9
+ options.classIgnore = []
10
+ }
11
+
12
if (options.replaceExtension === undefined) {
13
options.replaceExtension = false
14
15
16
return function posthtmlWebp (tree) {
17
tree.match([{ tag: 'img' }, { tag: 'amp-img' }], function (imgNode) {
18
if (imgNode.skip) return imgNode
19
+ var classes = imgNode.attrs && imgNode.attrs.class && (imgNode.attrs.class.split(' ') || [])
20
+ var isIgnore = options.classIgnore.filter(className => classes.includes(className)).length > 0
21
+ if (isIgnore) return imgNode
22
switch (imgNode.tag) {
23
case 'amp-img':
24
return getAmpPicture(imgNode, options)
0 commit comments