Skip to content

Commit d1edff9

Browse files
committed
Updated readme
1 parent 53ff8db commit d1edff9

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,17 @@ Exports HTML as string. HTML is minimized when the compiler demands.
44

55
By default every local `<img src="image.png">` is required (`require("./image.png")`). You may need to specify loaders for images in your configuration (recommended `file-loader` or `url-loader`).
66

7-
You can specify which tag-attribute combination should be processed by this loader via the query parameter `attrs`. Pass an array or a space-separated list of `<tag>:<attribute>` combinations. (Default: `attrs=img:src`)
7+
Also every `<img srcset="..."`> is converted to `require` statements. For example
8+
``` html
9+
<img src="image.jpg" srcset="image.jpg 1x, image@2x.jpg 2x">
10+
```
11+
is converted to
12+
``` javascript
13+
"<img src=\"" + require("./image.jpg") + "\" srcset=\"" + require("./image.jpg") + " 1x, " + require("./image@2x.jpg") + " 2x \">"
14+
```
15+
16+
17+
You can specify which tag-attribute combination should be processed by this loader via the query parameter `attrs`. Pass an array or a space-separated list of `<tag>:<attribute>` combinations. (Default: `attrs=[img:src, img:srcset]`)
818

919
To completely disable tag-attribute processing (for instance, if you're handling image loading on the client side) you can pass in `attrs=false`.
1020

0 commit comments

Comments
 (0)