I have a gulp task to go through some aspx files and replace css/js references in this files to have a version param(for cache busting purposes). Currently it seems to work pretty well except it doesn't seem to change the references on one of my aspx files and instead produces some weird characters at the beginning of that file i.e 뿯붿. Not sure if it matters that this is likely the last aspx file processed since its alphabetically the last. Here is what i have for my gulp task
gulp.task('updateAspxReferences', () =>
gulp.src(['*.aspx'])
.pipe(replace(/[a-z-]+\.js(\?v=)*[0-9.]*/gi, function(match){
var index = match.indexOf('?v=');
var file = match;
if(index > -1)
file = match.substring(0, index);
return file +'?v=' + version
}))
.pipe(replace(/[a-z-]+\.css(\?v=)*[0-9.]*/gi, function(match){
var index = match.indexOf('?v=');
var file = match;
if(index > -1)
file = match.substring(0, index);
return file +'?v=' + version
}))
.pipe(gulp.dest('./'))
);
From what I've seen this aspx file isn't different from the others so not sure why this is happening on this particular file.
I ended up changing the encoding if the file to ANSI through notepad++ to match my other aspx files. The original encoding was unicode. The gulp file is no longer adding the random characters and is renaming the appropriate references