jamesknelson / gulp-rev-replace

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

Replace longest strings first #22

Closed vvo closed 9 years ago

vvo commented 9 years ago

Hi,

This PR consist of a bux fixing and some minor refactoring.

The encoutered bug:

file.js:

var loadFile = "nopestyle.css";

style.css:

body {}

nopestyle.css:

html{}

Using gulp-rev-replace with this setup, you will endup with file.js being replaced with the reved version of style.css because the match is not done on the longest string, it was done on random string length based on the order files are pushed into the gulp stream.

I hope my explanation is clear, you can have a look at the newly created tests if not.

This is not the "perfect" solution but it's still sufficient.

Let met know @jamesknelson