From 8e3caec3336ff573fd8c2efc19fd539bd8fbe85e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=A3=E5=BC=BA?= Date: Fri, 29 Mar 2024 17:28:28 +0800 Subject: [PATCH] fix: fix scss compile order --- packages/semi-scss-compile/src/utils/writeFile.ts | 9 ++++++++- packages/semi-webpack/src/componentName.ts | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/semi-scss-compile/src/utils/writeFile.ts b/packages/semi-scss-compile/src/utils/writeFile.ts index 81663845cd..0b995cc4db 100644 --- a/packages/semi-scss-compile/src/utils/writeFile.ts +++ b/packages/semi-scss-compile/src/utils/writeFile.ts @@ -70,7 +70,14 @@ const preProcessScssMap = (scssMapOrigin: ReturnType) => const customScssRaw = scssMap.theme['custom.scss']; let allCustomRaw = ''; if (customScssRaw) { - for (const componentName of Object.keys(scssMap['components'])) { + const componentNames = Object.keys(scssMap['components']); + const orderList = ['tooltip', 'anchor', 'autoComplete', 'avatar', 'backtop', 'badge', 'banner', 'breadcrumb', 'button', 'calendar', 'card', 'carousel', 'cascader', 'checkbox', 'collapse', 'collapsible', 'datePicker', 'descriptions', 'divider', 'dropdown', 'empty', 'form', 'grid', 'highlight', 'image', 'input', 'inputNumber', 'list', 'modal', 'navigation', 'notification', 'pagination', 'popconfirm', 'popover', 'progress', 'radio', 'rating', 'scrollList', 'select', 'sideSheet', 'skeleton', 'slider', 'space', 'spin', 'steps', 'switch', 'table', 'tabs', 'tag', 'tagInput', 'timePicker', 'timeline', 'toast', 'transfer', 'tree', 'treeSelect', 'typography', 'upload']; + + componentNames.sort((a,b)=>{ + return orderList.indexOf(a) - orderList.indexOf(b); + }); + + for (const componentName of componentNames) { if (scssMap['components'][componentName]['variables.scss']) { allCustomRaw+= scssMap['components'][componentName]['variables.scss']+'\n'; } diff --git a/packages/semi-webpack/src/componentName.ts b/packages/semi-webpack/src/componentName.ts index 86d82d43ab..35313aa69f 100644 --- a/packages/semi-webpack/src/componentName.ts +++ b/packages/semi-webpack/src/componentName.ts @@ -59,4 +59,5 @@ const componentVariablePathList: string[] = [ '@douyinfe/semi-foundation/upload/variables.scss' ]; + export default componentVariablePathList;