File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -280,6 +280,41 @@ module.exports = {
280
280
};
281
281
```
282
282
283
+ Filter can also be used to extend the supported elements and attributes. For example, filter can help process meta tags that reference assets:
284
+
285
+ ``` js
286
+ module .exports = {
287
+ module: {
288
+ rules: [
289
+ {
290
+ test: / \. html$ / i ,
291
+ loader: ' html-loader' ,
292
+ options: {
293
+ attributes: {
294
+ list: [
295
+ {
296
+ tag: ' meta' ,
297
+ attribute: ' content' ,
298
+ type: ' src' ,
299
+ filter : (tag , attribute , attributes , resourcePath ) => {
300
+ if (
301
+ attributes .property === ' og:image' ||
302
+ attributes .name === ' twitter:image'
303
+ ) {
304
+ return true ;
305
+ }
306
+ return false ;
307
+ },
308
+ },
309
+ ],
310
+ },
311
+ },
312
+ },
313
+ ],
314
+ },
315
+ };
316
+ ```
317
+
283
318
#### ` urlFilter `
284
319
285
320
Type: ` Function `
You can’t perform that action at this time.
0 commit comments