Closed mattstratton closed 7 years ago
Hi @mattstratton
gulp-responsive
uses rename module to do filename changes.
In your config full path is changed:
rename: 'logo-square@2x.png'
To modify only filename you can use the following config:
rename: {
basename: 'logo-square@2x.png'
}
Bingo!
In case anyone in the future needs to see, I handled this better using "suffix", since that's more of what I wanted to do anyway, but it's good to know!
gulp.task('responsive-images', function () {
return gulp.src('public/**/logo-square.png')
.pipe(responsive({
// produce multiple images from one source
'**/*.png': [
{
width: '100%',
rename: {
suffix: '@2x'
}
}
]
}))
.pipe(gulp.dest('staging'));
});
I've got some POC code, that looks like this:
Inside the source directory, the path where images might be found are various event subfolders (for example,
public/events/hoofington-2017
, etc.The output I get from gulp is this:
And the only generated image is at the root of
staging
and islogo-square@2x.png
. None of theevents/2017-moscow
etc folders get populated.I'm not quite sure why this is happening. I know that right now it's not really doing anything interesting but renaming the file, but this was my attempt to at least see the subfolders work.