-
I have a scenario where I want to use tailwind for my app but not for a specific route. Because tailwind comes with some preflight styles which will break my ui in the specific route. I can of course manually import styles in every route but it is very cumbersome. What I want is I can import tailwind styles in the root route but in the very specific route I can remove the tailwind styles and just import the styles I need. e.g. I have three routes in my app:
I want to use My solution: // app/routes/index.tsx
export const links = () => {
return [{ rel: 'stylesheet', href: tailwindStyles }];
}
// app/routes/a.tsx
export const links = () => {
return [{ rel: 'stylesheet', href: tailwindStyles }];
}
// app/routes/b.tsx
export const links = () => {
return [{ rel: 'stylesheet', href: otherStyles }];
} Preferred: // app/root.tsx
export const links = () => {
return [{ rel: 'stylesheet', href: tailwindStyles }];
}
// app/routes/b
// currently tailwindStyles will also apply here, I need a way to remove it
export const links = () => {
return [{ rel: 'stylesheet', href: otherStyles }];
} Is it somehow possible? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You could use layout routes for that.
☝️ something like that. All layout routes starting with |
Beta Was this translation helpful? Give feedback.
You could use layout routes for that.
routes/__tailwind.tsx
route where you export the links loading the Tailwind styles and a default export with only an Outlet component.routes/__tailwind
folder, any route inside that directory will be nested inside theroutes/__tailwind.tsx
route so it will have tailwind styles.__tailwind
folder, those routes will not be nested inside__tailwind.tsx
so they will not have the styles.☝️ something like that.
All layout routes starting with
__
will not add segments to the URL so you will have/a