mirror of
https://github.com/vector-im/element-web.git
synced 2024-09-09 22:55:12 +00:00
Convert slashes in public paths
This commit is contained in:
parent
cf0b2816c1
commit
0802aaae91
1 changed files with 12 additions and 1 deletions
|
@ -69,7 +69,8 @@ module.exports = {
|
||||||
// CSS image usages end up in the `bundles/[hash]` output
|
// CSS image usages end up in the `bundles/[hash]` output
|
||||||
// directory, so we adjust the final path to navigate up
|
// directory, so we adjust the final path to navigate up
|
||||||
// twice.
|
// twice.
|
||||||
return path.join("../..", getImgOutputPath(url, resourcePath));
|
const outputPath = getImgOutputPath(url, resourcePath);
|
||||||
|
return toPublicPath(path.join("../..", outputPath));
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -198,3 +199,13 @@ function getImgOutputPath(url, resourcePath) {
|
||||||
const outputDir = path.dirname(resourcePath).replace(prefix, "");
|
const outputDir = path.dirname(resourcePath).replace(prefix, "");
|
||||||
return path.join(outputDir, path.basename(url));
|
return path.join(outputDir, path.basename(url));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert path to public path format, which always uses forward slashes, since it will
|
||||||
|
* be placed directly into things like CSS files.
|
||||||
|
*
|
||||||
|
* @param {string} path Some path to a file.
|
||||||
|
*/
|
||||||
|
function toPublicPath(path) {
|
||||||
|
return path.replace(/\\/g, '/');
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue