unpreset / unocss-preset-theme

The dynamic theme presets for UnoCSS.
https://unocss-preset-theme.todev.cc
119 stars 11 forks source link

media query in config `safelist` got wrong output `:root` css #68

Closed wtto00 closed 7 months ago

wtto00 commented 7 months ago

uno.config.ts

import { defineConfig, presetUno } from 'unocss'
import presetTheme from 'unocss-preset-theme'

export default defineConfig({
  presets: [
    presetUno(),
    presetTheme({
      theme: {
        dark: {
          colors: {
            foreground: '#FFF',
            background: '#0D0D0D',
          },
        },
      },
    }),
  ],
  theme: {
    colors: {
      foreground: '#000',
      background: '#FFF',
    },
  },
  safelist: ['md:text-sm']
})

The output css is:

/* layer: theme */
@media (min-width: 768px){
:root{font-size:0.875rem;line-height:1.25rem;}
}
/* layer: default */
@media (min-width: 768px){
.md\:text-sm{font-size:0.875rem;line-height:1.25rem;}
}

:root{font-size:0.875rem;line-height:1.25rem;} should't be generated.

Example playground