1
0
Fork 0
management/front/dkha-web-sz-main/node_modules/svg-sprite-loader/examples/interop-with-html-webpack-p...
zhurui 54669c07cf i4 2023-12-18 13:12:25 +08:00
..
build i4 2023-12-18 13:12:25 +08:00
README.md i4 2023-12-18 13:12:25 +08:00
main.js i4 2023-12-18 13:12:25 +08:00
template.ejs i4 2023-12-18 13:12:25 +08:00
webpack.config.js i4 2023-12-18 13:12:25 +08:00

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>
...