First hello and thanks a lot :)
In some cases the replacements are wrong.
I have a file name logo.svg and in my CSS I have a class like this:
After replacement it becomes:
.header-logo.5207648e7fbe6e1d.svg {
It's because of the . in the file name and the Regex at this line.
https://github.com/jhuesos/gulp-cachebust/blob/master/index.js#L123
. matches the space.
The filename should be escaped for RegExp.
My quick and dirty patch.
original = original.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
(from StackOverflow: https://stackoverflow.com/questions/3446170/escape-string-for-use-in-javascript-regex)
Sorry no time for a proper clean pull request. :)
First hello and thanks a lot :)
In some cases the replacements are wrong.
I have a file name logo.svg and in my CSS I have a class like this:
After replacement it becomes:
It's because of the . in the file name and the Regex at this line.
https://github.com/jhuesos/gulp-cachebust/blob/master/index.js#L123
. matches the space.
The filename should be escaped for RegExp.
My quick and dirty patch.
(from StackOverflow: https://stackoverflow.com/questions/3446170/escape-string-for-use-in-javascript-regex)
Sorry no time for a proper clean pull request. :)