Skip to content

Commit 010e13a

Browse files
committed
Refactor
1 parent 058e77b commit 010e13a

File tree

1 file changed

+20
-22
lines changed

1 file changed

+20
-22
lines changed

packages/tailwindcss-language-server/src/css/resolve-css-imports.ts

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,28 @@ const resolver = createResolver({
1010
conditionNames: ['style'],
1111
})
1212

13-
const resolveImports = postcss([
14-
postcssImport({
15-
async resolve(id, base) {
16-
try {
17-
return await resolveCssFrom(base, id)
18-
} catch (e) {
19-
// TODO: Need to test this on windows
20-
return `/virtual:missing/${id}`
21-
}
22-
},
23-
24-
load(filepath) {
25-
if (filepath.startsWith('/virtual:missing/')) {
26-
return Promise.resolve('')
27-
}
13+
export function resolveCssImports() {
14+
return postcss([
15+
postcssImport({
16+
async resolve(id, base) {
17+
try {
18+
return await resolveCssFrom(base, id)
19+
} catch (e) {
20+
// TODO: Need to test this on windows
21+
return `/virtual:missing/${id}`
22+
}
23+
},
2824

29-
return fs.readFile(filepath, 'utf-8')
30-
},
31-
}),
32-
fixRelativePaths(),
33-
])
25+
load(filepath) {
26+
if (filepath.startsWith('/virtual:missing/')) {
27+
return Promise.resolve('')
28+
}
3429

35-
export function resolveCssImports() {
36-
return resolveImports
30+
return fs.readFile(filepath, 'utf-8')
31+
},
32+
}),
33+
fixRelativePaths(),
34+
])
3735
}
3836

3937
export async function resolveCssFrom(base: string, id: string) {

0 commit comments

Comments
 (0)