Closed crodas closed 10 years ago
@Luismahou everything alright with this PR? I'm using it already on production and seems fine.
Thanks @crodas.
This PR is breaking the build: https://travis-ci.org/Luismahou/grunt-hashres/builds/18556951 Besides, it doesn't include any tests.
This issue is something I want to work on. I know it's an important problem and I was thinking in solving it in a different way. Sorting would fix your case, but I believe it won't work if we have two files called "bar.js" and "foobar.js".
Cheers
@Luismahou I'll add the tests if it'll be accepted (and will make pass tests which are broken)
And it will work, why? Because foobar.js
will be translated to foobar.<hash>.js
and bar.js
won't match. Or am I missing smething?
@Luismahou added tests
Thanks mate!
No problem, thanks for sharing it in the first place!
"Sort files by length ASC"
You're sorting in descending order:
file hashresHelper.js
line 70:
files.sort(function(a, b) {
return b[0].length - a[0].length;
});
It still doesn't work for me because of this. Swapping a and b does what you intended, and works for me.
It is useful to fix a race condition when a two or more filenames share the same postfix.
Foobar.js
andmobile-Foobar.js
sometimeFoobar.<hash>.js
would replacemobile-Foobar.js
.