Skip to content

Commit f36c7db

Browse files
authored
fix(playground): add reset styles for non-preset-wind4 configurations (#4938)
1 parent ef3eee4 commit f36c7db

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

playground/__play.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
</body>
2828

2929
<script type="module">
30-
import '@unocss/reset/tailwind.css'
31-
3230
const container = document.getElementById('container')
3331
const style = document.getElementById('style')
3432
const root = document.body.parentElement

playground/src/composables/uno.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import type { HighlightAnnotation, UnocssPluginContext } from '@unocss/core'
44
import type { GenerateResult, UserConfig } from 'unocss'
55
import { evaluateUserConfig } from '#docs'
66
import { unocssBundle } from '#docs/unocss-bundle'
7+
import reset from '@unocss/reset/tailwind.css?raw'
78
import MagicString from 'magic-string'
89
import { createGenerator } from 'unocss'
910

@@ -73,6 +74,13 @@ debouncedWatch(
7374
layer: customCSSLayerName,
7475
getCSS: () => cleanOutput(transformedCSS.value || ''),
7576
})
77+
// @ts-expect-error ignore
78+
if (!result.presets?.some(preset => preset.name === '@unocss/preset-wind4')) {
79+
preflights.push({
80+
layer: 'base',
81+
getCSS: () => reset,
82+
})
83+
}
7684

7785
result.preflights = preflights
7886
customConfig = result

0 commit comments

Comments
 (0)