Answer the question
In order to leave comments, you need to log in
How to copy images to one folder ./build/img and fix url to them in css?
When building an HTML template, what about plugin images that are included as dependencies from the node_modules or bower_modules folders? With CSS it's clear - copied, merged, compressed, etc. And with the images that we ourselves added and store in a folder like ./src/img/*.jpg, everything is also simple, you just need to save the relative paths to CSS and images.
But when we connect plugins, they can have their own relative paths to images - for example, a folder may not be called img but image, or images may be in the same folder with CSS.
I see the following solution to this problem: when concatenating CSS, you need to read the paths to the pictures, edit them to those that we have in the project (for example, it was ./image/pic.jpg became ./img/pic.css), then copy the pictures along the new path to our build folder.
Does anyone know a plugin that can do this?
It would also be great if this plugin added their hash to the names of the pictures, as the names of the pictures in the plugin can match the names of the project pictures, and, accordingly, take this into account when editing paths in CSS.
I hope I have explained my problem clearly.
Answer the question
In order to leave comments, you need to log in
and not easier to typeset normally and initially have only 2 folders with pictures. one folder for connecting to html in the <img> tag for example, and a second folder for css background styles. and plug-ins immediately remake for themselves and change their default folders of images to their own?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question