Skip to content

Commit

Permalink
fix(plugin-sass-palette): fix module injecting
Browse files Browse the repository at this point in the history
  • Loading branch information
Mister-Hope committed Dec 13, 2024
1 parent 1058958 commit 356e1a2
Showing 1 changed file with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,27 +64,28 @@ export const injectScssConfigModule = (
source: string,
file: string,
): Promise<string> => {
let originalResult = ''
let originalResult = source

if (isString(originalAdditionalData))
originalResult = `${originalAdditionalData}${source}`
else if (isFunction(originalAdditionalData)) {
if (isFunction(originalAdditionalData)) {
const result = await originalAdditionalData(source, file)

originalResult = isString(result) ? result : result.content
}
} else if (isString(originalAdditionalData))
originalResult = `${originalAdditionalData}${source}`

if (
!originalResult.includes(configModuleName) &&
originalResult.includes(configModuleName) &&
!originalResult.match(configRegExp)
)
originalResult = `${configImport}\n${originalResult}`
if (
!originalResult.includes(paletteModuleName) &&
originalResult.includes(paletteModuleName) &&
!originalResult.match(paletteRegExp)
)
originalResult = `${paletteImport}\n${originalResult}`

console.log(originalResult)

Check warning on line 87 in plugins/development/plugin-sass-palette/src/node/injectScssConfigModule.ts

View workflow job for this annotation

GitHub Actions / build-check

Unexpected console statement

Check warning on line 87 in plugins/development/plugin-sass-palette/src/node/injectScssConfigModule.ts

View workflow job for this annotation

GitHub Actions / bundle-check

Unexpected console statement

return originalResult
},
},
Expand Down Expand Up @@ -113,13 +114,13 @@ export const injectScssConfigModule = (
: content

if (
!originalContent.includes(configModuleName) &&
originalContent.includes(configModuleName) &&
!originalContent.match(configRegExp)
)
originalContent = `${configImport}\n${originalContent}`

if (
!originalContent.includes(paletteModuleName) &&
originalContent.includes(paletteModuleName) &&
!originalContent.match(paletteRegExp)
)
originalContent = `${paletteImport}\n${originalContent}`
Expand Down

0 comments on commit 356e1a2

Please sign in to comment.