E
E
Edward Treit2019-04-06 09:43:04
npm
Edward Treit, 2019-04-06 09:43:04

How to convert images via npm script while maintaining folder structure?

Good day. There is an npm script based on imagemin-cli:

"webp": "imagemin --plugin=webp build/img/**/*.{jpg,png} --out-dir=build/img/webp".

In the build folder, there are, for example, more folders, foo and bar. How to make images in webp format be saved in a separate webp folder for each of the foo and bar folders, i.e. build/img/foo/images => build/img/foo/webp/images and build/img/bar/images => build/img/bar/webp/images

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