File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,29 @@ require("html?attrs[]=img:src&attrs[]=img:data-src!./file.html");
44
44
45
45
// / minimized by running `webpack --optimize-minimize`
46
46
// => '<img src=http://cdn.example.com/49e...ba9f/a9f...92ca.jpg data-src=data:image/png;base64,...>'
47
+
48
+ ```
49
+
50
+ ## 'Root-relative' urls
51
+
52
+ For urls that start with a ` / ` , the default behavior is to not translate them.
53
+ If a ` root ` query parameter is set, however, it will be prepended to the url
54
+ and then translated.
55
+
56
+ With the same configuration above:
57
+ ``` html
58
+ <!-- fileB.html -->
59
+ <img src =" /image.jpg" >
60
+ ```
61
+
62
+ ``` javascript
63
+
64
+ require (" html!./fileB.html" );
65
+ // => '<img src="/image.jpg">'
66
+
67
+ require (" html?root=.!./fileB.html" );
68
+ // => '<img src="http://cdn.example.com/49e...ba9f/a9f...92ca.jpg">'
69
+
47
70
```
48
71
49
72
## License
You can’t perform that action at this time.
0 commit comments