After exploring a variety of solutions, I have yet to find success in modifying a file in place using Gulp.js with a globbing pattern.
The specific issue I am facing can be found here.
This is the code snippet I am currently working with:
var fstrm = require('gulp');
var inlineCss = require('gulp-inline-css');
var rename = require("gulp-rename");
(function() {
fstrm.src("emails/**/index.html")
.pipe(inlineCss({}))
.pipe(rename("inline.html"))
.pipe(fstrm.dest("emails"));
}());
The code successfully finds and inlines CSS for all index.html files within subdirectories under emails/
. However, the problem arises when attempting to write the modified files back into their original subdirectories; instead, they are all saved in the main 'emails/' directory, overwriting the previous inline.html file each time. It seems like only the last file processed remains.
Despite trying various suggestions from different sources without success, I wonder if there have been changes in fileglob or gulp that may affect this process. I even attempted running the code with vinyl-fs instead of gulp, but encountered the same issue.