A
A
Andrey Neumyvanny2020-05-27 11:54:41
webpack
Andrey Neumyvanny, 2020-05-27 11:54:41

How to collect images in different directories in the final webpack bundle?

Good afternoon! I am writing a project, following the BEM component approach, in the component (folder) there are three files - an image + a template (for example .pug) + styles (for example .scss). There will be quite a lot of such components in UI-kit. then collect entire pages on them. It’s clear with styles and templates, imports, etc. But I can’t figure it out with pictures. I used Copy-webpack-plugin before, but it just copies the entire from/to directory. And in theory, I need to go through the directory with the components, pick up all the pictures, and drop them into a specific folder on the output. At the same time, do not mess up the paths to the pictures in the .pug templates. Of course, you can write all the paths to each image in the plugin, but what if there are a lot of them?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question