jamesknelson / gulp-rev-replace

Rewrite occurences of filenames which have been renamed by gulp-rev
MIT License
389 stars 62 forks source link

Can only be replaced once ? #62

Open xiaoshuimao opened 8 years ago

xiaoshuimao commented 8 years ago

md5.json

a.js: a-abcdefg.js

This covers the original file

return gulp.src('**/*.php')
                    .pipe(revReplace({
                        manifest: manifest,
                        replaceInExtensions: ['.php', '.jsp']
                    }))
                    .pipe(gulp.dest('./')); // This covers the original file

After replacement,

index.php

<script src="a-abcdefg.js"></script>

ok, this is no problem.but i change the md5.json like this:

md5.json

a.js: a-xxxxx.js

After replacement,

index.php

<script src="a-abcdefg.js"></script>

Not replaced, because md5.json has not 'a-abcdefg.js' in the ‘key’。

One way is to retain the original file

return gulp.src('**/*.php')
                    .pipe(revReplace({
                        manifest: manifest,
                        replaceInExtensions: ['.php', '.jsp']
                    }))
                    .pipe(gulp.dest('./build')); // retain the original file, output different directory

If I want to cover the original file, Is there a way to solve it or path matching rules under which files?