diff --git a/lib/process-style.js b/lib/process-style.js index 49bc6c82..d9bf89a3 100644 --- a/lib/process-style.js +++ b/lib/process-style.js @@ -12,11 +12,8 @@ function getGlobalResources(resources, lang, filePath) { if (resources && resources[lang]) { globalResources = resources[lang] .map(resource => { - const relativePath = path.relative( - path.dirname(filePath), - path.resolve(process.cwd(), resource) - ) - return `${getImportLine(lang, relativePath)}\n` + const absolutePath = path.resolve(process.cwd(), resource) + return `${getImportLine(lang, absolutePath)}\n` }) .join('') } @@ -24,12 +21,11 @@ function getGlobalResources(resources, lang, filePath) { } function getImportLine(lang, filePath) { - const placeholder = '__PATH__' - const formats = { - default: `@import "${placeholder}";`, - sass: `@import "${placeholder}"` + const importLines = { + default: `@import "${filePath}";`, + sass: `@import "${filePath}"` } - return (formats[lang] || formats.default).replace(placeholder, filePath) + return importLines[lang] || importLines.default } function extractClassMap(cssCode) {