Skip to content

Commit

Permalink
Merge branch 'master' of github.com:aviteng/css-server
Browse files Browse the repository at this point in the history
  • Loading branch information
mehmetb committed May 7, 2018
2 parents abcce35 + 741330f commit d88a0f8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/CssProcessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@ function replacePattern(inStr, pattern, replacement) {
return inStr.replace(re, replacement);
}

function escapeOctalLiterals(content) {
return content.replace(/\\/g, '\\\\');
}

function readFile(filePath) {
return new Promise((resolve, reject) => {
fs.readFile(filePath, 'utf8', (err, content) => {
if (err) return reject(err);

resolve(content);
resolve(escapeOctalLiterals(content));
});
});
}
Expand All @@ -30,11 +34,13 @@ async function fetchFile(possiblePaths = []) {

return resolve(content);
} catch (ex) {
if (ex.code != 'ENOENT') {
if (ex.code != 'ENOENT' || i == possiblePaths.length - 1) {
return reject(ex);
}
}
}

return resolve('');
});
}

Expand Down

0 comments on commit d88a0f8

Please sign in to comment.