Skip to content

Commit 8a43165

Browse files
authored
Merge pull request #69 from Simon-He95/copilot/ci-fix-windows-test-issue
Fix Windows CI: normalize backslash paths in SCSS/Stylus alias resolution
2 parents f235866 + 5069899 commit 8a43165

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

src/sassCompiler.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,9 @@ export async function sassCompiler(
302302
// keep original resolved if path ops fail
303303
}
304304

305+
// Normalize to forward slashes for Sass compatibility on Windows
306+
finalPath = finalPath.replace(/\\/g, '/')
307+
305308
if (debug) {
306309
console.log(
307310
`[transform-to-unocss] Rewriting ${kw} ${impPath} -> ${finalPath}`,

src/stylusCompiler.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export async function stylusCompiler(
3636
a.replacement,
3737
imp.slice(a.find.length),
3838
)
39-
return `@import '${resolved}'`
39+
return `@import '${resolved.replace(/\\/g, '/')}'`
4040
}
4141
}
4242
}
@@ -47,12 +47,12 @@ export async function stylusCompiler(
4747
const resolved = path.isAbsolute(val)
4848
? path.join(val, imp.slice(k.length))
4949
: path.join(process.cwd(), val, imp.slice(k.length))
50-
return `@import '${resolved}'`
50+
return `@import '${resolved.replace(/\\/g, '/')}'`
5151
}
5252
}
5353
}
5454
// fallback to src
55-
return `@import '${path.resolve(process.cwd(), 'src', rel)}'`
55+
return `@import '${path.resolve(process.cwd(), 'src', rel).replace(/\\/g, '/')}'`
5656
})
5757
}
5858
catch (e) {

0 commit comments

Comments
 (0)