cmy 02a04f55a0 2023-3-15 2 lat temu
..
build 02a04f55a0 2023-3-15 2 lat temu
README.md 02a04f55a0 2023-3-15 2 lat temu
main.js 02a04f55a0 2023-3-15 2 lat temu
template.ejs 02a04f55a0 2023-3-15 2 lat temu
webpack.config.js 02a04f55a0 2023-3-15 2 lat temu

README.md

HTML webpack plugin interop

When using html-webpack-plugin along with sprite-loader in extract mode it is possible to inline sprite content directly to the page. All extracted sprites stored in htmlWebpackPlugin.files.sprites template variable. It's an object where key is a sprite filename and value - file contents (Object<filename:string, content:string>).

Demo

Template example

...
<body>

<% if (htmlWebpackPlugin.files.sprites) { %>
  <% for (var spriteFileName in htmlWebpackPlugin.files.sprites) { %>
    <%= htmlWebpackPlugin.files.sprites[spriteFileName] %>
  <% } %>
<% } %>

</body>
...