zhangaz1/gulp-rev-orig

Relative path recognition not working

Opened this issue · 0 comments

Hi,
There is a problem with recognition if a file is referenced by relative path. Everything works correct for the first file, but if there are multiple files with relative paths in a row, every second file path is treated as absolute path.
Example:

gulp.task('revOrig-withBase', function(argument) {
    gulp.src('test.html')
        .pipe(revOrig({
            base: 'assets/'
        }))
        .pipe(gulp.dest('./dist'));
});

for html file with 2 relative reference paths:

<script src="/../assets/index.js"></script>
<script src="/../assets/index.js"></script>

results an single file not found message, and invalid output:

    <script src="/../assets/index.js?v=3fffb693"></script>
    <script src="/../assets/index.js"></script>

The above can be fixed by removing "g" option from regular expression options in line 13.
var regOption = 'i';

Best regards,