I'm having issues trying to run gulp-rev-all correctly in html files within subfolders. My current site structure is kind of this:
/index.html
/gulpfile.js
/appsubFolder
|-> index.html
/Content
|-> some.css
|-> someOther.css
/Scripts
|-> some.js
|-> someOther.js
The file /appsubFolder/index.html
has the build tags declared like this:
<!-- build:css ../Content/styles.min.css -->
<link href="../Content/some.css" rel="stylesheet">
<link href="../Content/someOther.css" rel="stylesheet">
<!-- endbuild -->
And then in the gulpfile, I have the task configured like this:
gulp.task('minifyBundleRevision', ['clean:bundles', 'publish'], function () {
var revAll = new $.revAll({ dontRenameFile: ['.html'], debug: true });
return gulp.src('appsubFolder/index.html')
.pipe($.useref())
.pipe($.if("*.js", $.uglify()))
.pipe($.if("*.css", $.uglifycss()))
.pipe(revAll.revision())
.pipe(gulp.dest(publishFolder + '/appsubFolder'));
});
Problem is, everything runs fine, but the file appsubFolder/index.html
ends up with the section like this:
<link href="../Content/styles.min.css" rel="stylesheet">
instead of
<link href="../Content/styles.min.[hash-here].css" rel="stylesheet">
despite of the fact that in folders Content
and Scripts
, the files appear there with the hashes on their names.
So the problem is that even when the revision function runs well on files, it's not replacing correctly the html in the file /appsubFolder/index.html
Worth to note is everything runs well on /index.html
.
How should I fix this?