Answer the question
In order to leave comments, you need to log in
How to configure Gulp to move files with specific name endings through folders?
What is?
There are images in a specific folder with names ending in *_mdpi.png, *_hdpi.png, *_xhdpi.png, in general resource files for Android mobile developers.
What is needed?
You need images with a specific ending, for example - *_mdpi.png to optimize and move to the drawable-mdpi folder, *_hdpi.png, respectively, to the drawable-hdpi folder, etc.
How to set it up with gulp? I decided to get confused in order to automate the distribution of resources for mobile developers into folders, otherwise now I have to do it all by hand.
Answer the question
In order to leave comments, you need to log in
const gulp = require('gulp');
const es = require('event-stream');
gulp.task('move:img', (cb) => {
let mdpi = gulp.src('./img/**/*_mdpi.png')
.pipe(gulp.dest('./dist/mdpi'));
let hdpi = gulp.src('./img/**/*_hdpi.png')
.pipe(gulp.dest('./dist/hdpi'));
let xhdpi = gulp.src('./img/**/*_xhdpi.png')
.pipe(gulp.dest('./dist/xhdpi'));
return es.concat(mdpi, hdpi, xhdpi);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question