1 | # HTML webpack plugin interop
|
2 |
|
3 | When using [html-webpack-plugin](https://github.com/jantimon/html-webpack-plugin) along with sprite-loader in extract mode it is possible
|
4 | to inline sprite content directly to the page. All extracted sprites stored in `htmlWebpackPlugin.files.sprites` template variable.
|
5 | It's an object where key is a sprite filename and value - file contents (`Object<filename:string, content:string>`).
|
6 |
|
7 | ### [Demo](build/index.html)
|
8 |
|
9 | ### Template example
|
10 |
|
11 | ```ejs
|
12 | ...
|
13 | <body>
|
14 |
|
15 | <% if (htmlWebpackPlugin.files.sprites) { %>
|
16 | <% for (var spriteFileName in htmlWebpackPlugin.files.sprites) { %>
|
17 | <%= htmlWebpackPlugin.files.sprites[spriteFileName] %>
|
18 | <% } %>
|
19 | <% } %>
|
20 |
|
21 | </body>
|
22 | ...
|
23 | ```
|