Skip to content

Commit 9d43ec6

Browse files
authored
Merge pull request #36 from bryanwood/css-tmpdir-posix-style-path
make the path returned by tmpdir() posix style slashes
2 parents d670654 + 78ff4de commit 9d43ec6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

index.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ const { getOptions } = require('loader-utils');
44
const { statSync, utimesSync, writeFileSync } = require('fs');
55
const { tmpdir } = require('os');
66

7+
function posixify(file) {
8+
return file.replace(/[/\\]/g, '/');
9+
}
10+
711
function sanitize(input) {
812
return basename(input).
913
replace(extname(input), '').
@@ -36,7 +40,8 @@ module.exports = function(source, map) {
3640
let { code, map, css, cssMap, ast } = compile(processed.toString(), options);
3741

3842
if (options.emitCss && css) {
39-
const tmpFile = posix.join(tmpdir(), 'svelte-' + ast.hash + '.css');
43+
const posixTmpdir = posixify(tmpdir());
44+
const tmpFile = posix.join(posixTmpdir, 'svelte-' + ast.hash + '.css');
4045

4146
css += '\n/*# sourceMappingURL=' + cssMap.toUrl() + '*/';
4247
code = code + `\nrequire('${tmpFile}');\n`;

0 commit comments

Comments
 (0)