Skip to content

Commit

Permalink
fix(scss-renderer): #290 fixed fast-glob issue on windows
Browse files Browse the repository at this point in the history
When importing the SCSS file paths of components, there was a problem
that fast-glob did not automatically correct the path-pattern of
windows, so the problem was found that the SCSS build was not carried
out.

Solved it by adding a process to correct path on windows platform.
  • Loading branch information
mulder21c committed Sep 3, 2023
1 parent d211789 commit d252be7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion scripts/renderer/scss-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ const {
themeConfig: { prefix: themePrefix },
themeRoot,
} = require("../constants");
const componentsScssFiles = path.resolve(themeRoot, `components/**/*.scss`);
const isWindows = process.platform === `win32`;
const componentsScssFiles = isWindows
? glob.win32.convertPathToPattern(
path.resolve(themeRoot, `components/**/*.scss`)
)
: path.resolve(themeRoot, `components/**/*.scss`);
const cssSourcePath = path.resolve(themeRoot, `./source/css/`);
const componentsPath = path.resolve(themeRoot, `./components/`);

Expand All @@ -29,6 +34,7 @@ function scssRenderer(data, option) {
return new Promise(function (resolve, reject) {
const prepend =
glob.sync([componentsScssFiles]).reduce((code, path) => {
if (isWindows) path = glob.win32.convertPathToPattern(path);
// generate global variable & import statement
return `${code}@import "${path}";\n`;
}, `$prefix: ${themePrefix};\n@layer theme {\n`) + "\n}";
Expand Down

0 comments on commit d252be7

Please sign in to comment.