Skip to content

Commit af32ba1

Browse files
committed
fix: less stylesheets as global resources
1 parent 411d1e8 commit af32ba1

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

lib/process-style.js

+6-10
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,20 @@ function getGlobalResources(resources, lang, filePath) {
1212
if (resources && resources[lang]) {
1313
globalResources = resources[lang]
1414
.map(resource => {
15-
const relativePath = path.relative(
16-
path.dirname(filePath),
17-
path.resolve(process.cwd(), resource)
18-
)
19-
return `${getImportLine(lang, relativePath)}\n`
15+
const absolutePath = path.resolve(process.cwd(), resource)
16+
return `${getImportLine(lang, absolutePath)}\n`
2017
})
2118
.join('')
2219
}
2320
return globalResources
2421
}
2522

2623
function getImportLine(lang, filePath) {
27-
const placeholder = '__PATH__'
28-
const formats = {
29-
default: `@import "${placeholder}";`,
30-
sass: `@import "${placeholder}"`
24+
const importLines = {
25+
default: `@import "${filePath}";`,
26+
sass: `@import "${filePath}"`
3127
}
32-
return (formats[lang] || formats.default).replace(placeholder, filePath)
28+
return importLines[lang] || importLines.default
3329
}
3430

3531
function extractClassMap(cssCode) {

0 commit comments

Comments
 (0)