0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-30 01:46:24 +01:00
wagtail/gulpfile.js/lib/normalize-path.js
Aarni Koskela 6f18c5ea0f Fix static asset building on Windows
Normalize all paths to have only forward slashes before mangling them.
2016-01-19 13:14:05 +00:00

14 lines
397 B
JavaScript

var quoteRegExp = function (str) {
return (str + '').replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&");
};
var re = new RegExp(quoteRegExp(require("path").sep), "g");
/**
* Normalize path separators to forward slashes
* @param path A path in either Windows or POSIX format
* @returns {string} A path in POSIX format
*/
module.exports = function (path) {
return ("" + path).replace(re, "/");
};