简体   繁体   中英

Load mantine styles after Tailwind preflight

I'm trying to use Mantine and Tailwind together, however Tailwind's "preflight" base styles are overriding Mantine's resulting in a simple button being invisible.

在此处输入图像描述

You can disable preflight:

  corePlugins: {
    preflight: true
  }

But I'd rather keep it enabled and load Mantine CSS after, per this suggestion .

Is there any way to specify order for this?

Two steps: Add preflight: false in tailwind.config.js to disable the default

Copy out https://unpkg.com/tailwindcss@3.2.4/src/css/preflight.css refereed by https://tailwindcss.com/docs/preflight and import it in your entry point

Create a Emotion Cache using createEmotionCache from Mantine core and set prepend to false. Then call it inside MantineProvider's emotionCache prop.

 import { MantineProvider, createEmotionCache } from '@mantine/core'; const myCache = createEmotionCache({ key: 'mantine', prepend: false }); < MantineProvider emotionCache = { myCache } > { children } < /MantineProvider>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM