From e291747b369946d9ddfceb5b2992c36b4312ae33 Mon Sep 17 00:00:00 2001 From: Aliullov Vlad Date: Wed, 11 Dec 2024 11:15:08 +0400 Subject: [PATCH 1/3] remove all css imports from result instead only from variables.scss (T1265287) --- .../src/modules/bootstrap-extractor.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/devextreme-themebuilder/src/modules/bootstrap-extractor.ts b/packages/devextreme-themebuilder/src/modules/bootstrap-extractor.ts index 8269429532dc..1a58722efc71 100644 --- a/packages/devextreme-themebuilder/src/modules/bootstrap-extractor.ts +++ b/packages/devextreme-themebuilder/src/modules/bootstrap-extractor.ts @@ -77,17 +77,17 @@ export default class BootstrapExtractor { } const result = `${functions} -${this.getVariables(variables)} +${variables} ${variablesDark} ${this.input} ${this.getSetterServiceCode('!default')} ${this.getCollectorServiceCode()}`; - return result; + return this.clearFromImports(result); } - getVariables(variables: string): string { - return variables.replace(/^@import "variables-dark";.*$/gm, ''); + clearFromImports(content: string): string { + return content.replace(/^@import "variables-dark";.*$/gm, ''); } getFilePath(fileName: string): string { From 49e21ea81789bf3caa0f1556233704abdd57cc0a Mon Sep 17 00:00:00 2001 From: Aliullov Vlad Date: Wed, 11 Dec 2024 11:28:05 +0400 Subject: [PATCH 2/3] add test for (T1265287) --- .../tests/modules/bootstrap-extractor.test.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/devextreme-themebuilder/tests/modules/bootstrap-extractor.test.ts b/packages/devextreme-themebuilder/tests/modules/bootstrap-extractor.test.ts index bd0c843c9b40..f238300def70 100644 --- a/packages/devextreme-themebuilder/tests/modules/bootstrap-extractor.test.ts +++ b/packages/devextreme-themebuilder/tests/modules/bootstrap-extractor.test.ts @@ -37,9 +37,12 @@ describe('BootstrapExtractor', () => { extractor.getSetterServiceCode = (): string => setterServiceCode; extractor.getCollectorServiceCode = (): string => collectorServiceCode; - expect(await extractor.sassProcessor()) - .toBe(`${functions.toString()} -${extractor.getVariables(variables.toString())} + const result = await extractor.sassProcessor(); + + expect(result.includes('@import "variables-dark";')).toBeFalsy(); + + expect(result).toBe(`${functions.toString()} +${variables.toString()} ${variablesDark.toString()} ${testSassString} ${setterServiceCode} From 5610109fb3cce3b8650e3057cc2eaebdd933f2ad Mon Sep 17 00:00:00 2001 From: Aliullov Vlad Date: Wed, 11 Dec 2024 11:54:32 +0400 Subject: [PATCH 3/3] rename and fix test (T1265287) --- .../src/modules/bootstrap-extractor.ts | 4 ++-- .../tests/modules/bootstrap-extractor.test.ts | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/devextreme-themebuilder/src/modules/bootstrap-extractor.ts b/packages/devextreme-themebuilder/src/modules/bootstrap-extractor.ts index 1a58722efc71..cd8458864527 100644 --- a/packages/devextreme-themebuilder/src/modules/bootstrap-extractor.ts +++ b/packages/devextreme-themebuilder/src/modules/bootstrap-extractor.ts @@ -83,10 +83,10 @@ ${this.input} ${this.getSetterServiceCode('!default')} ${this.getCollectorServiceCode()}`; - return this.clearFromImports(result); + return this.removeImports(result); } - clearFromImports(content: string): string { + removeImports(content: string): string { return content.replace(/^@import "variables-dark";.*$/gm, ''); } diff --git a/packages/devextreme-themebuilder/tests/modules/bootstrap-extractor.test.ts b/packages/devextreme-themebuilder/tests/modules/bootstrap-extractor.test.ts index f238300def70..893de90e7427 100644 --- a/packages/devextreme-themebuilder/tests/modules/bootstrap-extractor.test.ts +++ b/packages/devextreme-themebuilder/tests/modules/bootstrap-extractor.test.ts @@ -41,12 +41,14 @@ describe('BootstrapExtractor', () => { expect(result.includes('@import "variables-dark";')).toBeFalsy(); - expect(result).toBe(`${functions.toString()} + const expectedResult = `${functions.toString()} ${variables.toString()} ${variablesDark.toString()} ${testSassString} ${setterServiceCode} -${collectorServiceCode}`); +${collectorServiceCode}`; + + expect(result).toBe(extractor.removeImports(expectedResult)); }); test('getSetterServiceCode', () => {