diff --git a/lib/utils/replace-sprite-placeholder.js b/lib/utils/replace-sprite-placeholder.js index 7128949..aca58ca 100644 --- a/lib/utils/replace-sprite-placeholder.js +++ b/lib/utils/replace-sprite-placeholder.js @@ -1,5 +1,7 @@ const escapeRegExpSpecialChars = require('escape-string-regexp'); +const isWindows = /^win/i.test(process.platform); + /** * @param {string} content * @param {Object} replacements @@ -9,9 +11,10 @@ function replaceSpritePlaceholder(content, replacements) { let result = content; Object.keys(replacements) .map((subj) => { + const normalizedSubj = isWindows ? subj.replace(/\\/g, '\\\\') : subj; return { subj, - re: new RegExp(escapeRegExpSpecialChars(subj), 'g') + re: new RegExp(escapeRegExpSpecialChars(normalizedSubj), 'g') }; }) .forEach(({ subj, re }) => {