Skip to content

Commit c28bf7c

Browse files
authored
Support picture srcset attr, save .webp to images dir, close #179 (#182)
1 parent ff659f1 commit c28bf7c

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lib/config/defaults.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ var config = {
1515
{ selector: 'link[rel="stylesheet"]', attr: 'href' },
1616
{ selector: 'link[rel*="icon"]', attr: 'href' },
1717
{ selector: 'svg *[xlink\\:href]', attr: 'xlink:href' },
18-
{ selector: 'svg *[href]', attr: 'href' }
18+
{ selector: 'svg *[href]', attr: 'href' },
19+
{ selector: 'picture source', attr: 'srcset' }
1920
],
2021
subdirectories: [
21-
{ directory: 'images', extensions: ['.png', '.jpg', '.jpeg', '.gif'] },
22+
{ directory: 'images', extensions: ['.png', '.jpg', '.jpeg', '.gif', '.webp'] },
2223
{ directory: 'js', extensions: ['.js'] },
2324
{ directory: 'css', extensions: ['.css'] },
2425
{ directory: 'fonts', extensions: ['.ttf', '.woff', '.woff2', '.eot', '.svg'] }

lib/resource-handler/html/html-source-element.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ var utils = require('../../utils');
77
var pathContainersByRule = [
88
{ selector: '[style]', attr: 'style', containerClass: CssText },
99
{ selector: 'style', containerClass: CssText },
10-
{ selector: 'img[srcset]', attr: 'srcset', containerClass: ImgSrcsetTag }
10+
{ selector: '*[srcset]', attr: 'srcset', containerClass: ImgSrcsetTag }
1111
];
1212

1313
/**

0 commit comments

Comments
 (0)