-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
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:
.header-logo svg {
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. :)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels