Skip to content

Commit

Permalink
fix(svelte-scoped): Remove assignment leading to race conditions (#2922)
Browse files Browse the repository at this point in the history
Co-authored-by: Jacob Bowdoin <7559478+jacob-8@users.noreply.github.com>
  • Loading branch information
scheatkode and jacob-8 committed Aug 1, 2023
1 parent 44ec3c8 commit 1d1bec1
Showing 1 changed file with 3 additions and 6 deletions.
Expand Up @@ -43,22 +43,19 @@ function updateTemplateCodeIfNeeded(codeUpdates: ProcessResult['codeUpdate'][],
}
}

const removeCommentsToMakeGlobalWrappingEasy = true
const REMOVE_COMMENTS_TO_MAKE_GLOBAL_WRAPPING_EASY = true

async function generateStyles(rulesToGenerate: ProcessResult['rulesToGenerate'], uno: UnoGenerator<object>) {
const originalShortcuts = uno.config.shortcuts

const shortcutsForThisComponent = Object.entries(rulesToGenerate)
uno.config.shortcuts = [...originalShortcuts, ...shortcutsForThisComponent]
uno.config.shortcuts.push(...shortcutsForThisComponent)

const selectorsToGenerate = Object.keys(rulesToGenerate)
const { css } = await uno.generate(selectorsToGenerate,
{
preflights: false,
safelist: false,
minify: removeCommentsToMakeGlobalWrappingEasy,
minify: REMOVE_COMMENTS_TO_MAKE_GLOBAL_WRAPPING_EASY,
})
uno.config.shortcuts = originalShortcuts

const cssPreparedForSvelteCompiler = wrapSelectorsWithGlobal(css)
return cssPreparedForSvelteCompiler
Expand Down

0 comments on commit 1d1bec1

Please sign in to comment.