We recommend keeping this file in the root of your project.Location matters! The location of global.css determines your app root - Tailwind will automatically scan for classNames starting from this directory. If you place global.css in a nested folder (like app/global.css), classNames in other directories won’t be detected unless you explicitly include them using the @source directive.
Import global.css file
Import the CSS file in your App.tsx (main component).
Copy
Ask AI
import './global.css' // <-- file from previous step// other importsexport const App = () => {} // <-- your app's main component
Don’t import global.css in the root index.ts/index.js file where you register the Root Component, as any change will trigger a full reload instead of hot reload.
Copy
Ask AI
// ‼️ Don't do thatimport './global.css';import { registerRootComponent } from 'expo';import { App } from './src'; // <- ✅ import it somewhere in the src folderregisterRootComponent(App);
If you don’t see a metro.config.js file in your project, you can create it with npx expo customize metro.config.js.
metro.config.js
Copy
Ask AI
const { getDefaultConfig } = require('expo/metro-config');const { withUniwindConfig } = require('uniwind/metro'); const config = getDefaultConfig(__dirname);// your metro modificationsmodule.exports = withUniwindConfig(config, { // relative path to your global.css file (from previous step) cssEntryFile: './src/global.css', // (optional) path where we gonna auto-generate typings // defaults to project's root dtsFile: './src/uniwind-types.d.ts'});
We recommend placing the uniwind-types.d.ts file in the src or app directory, as it will be automatically included by TypeScript. For custom paths (e.g., root of your project), please include it in your tsconfig.json.
You need to run metro server to generate typings and fix all TypeScript errors.
Important:withUniwindConfig must be the outermost wrapper in your Metro config. If you use other Metro config wrappers, make sure withUniwindConfig wraps them all.
const { getDefaultConfig } = require('@react-native/metro-config')const { withUniwindConfig } = require('uniwind/metro'); const config = getDefaultConfig(__dirname);// your metro modificationsmodule.exports = withUniwindConfig(config, { // relative path to your global.css file (from previous step) cssEntryFile: './src/global.css', // (optional) path where we gonna auto-generate typings // defaults to project's root dtsFile: './src/uniwind-types.d.ts'});
We recommend placing the uniwind-types.d.ts file in the src or app directory, as it will be automatically included by TypeScript. For custom paths (e.g., root of your project), please include it in your tsconfig.json.
You need to run metro server to generate typings and fix all TypeScript errors.
Important:withUniwindConfig must be the outermost wrapper in your Metro config. If you use other Metro config wrappers, make sure withUniwindConfig wraps them all.