#Different global css for different routes
11 messages · Page 1 of 1 (latest)
Hey Cheebamba
what you can do is create a scoped style per route.
styles for pages I usually place under /styles/Page1.module.scss
then you can do something like this
import s from '../styles/Page1.module.scss'
const Page1 = () => {
return (
<div className={s.root}>
.. Content of the page here
</div>
)
}
and what if I want to use tailwind on the admin and something else on the front?
You can import the global.css or tailwind on _app.js for centering global style
but I dont want tailwind globally - only for /admin routes
probably a good timing to introduce 2 apps
instead of one admin area within the app
I'll guess I'll go with that. Thanks
@rose onyx I'm using antd only in my admin part of the app, here's how I did to selectively import antd.css for my admin route. Hope it helps
- Create a dynamic Component that import the css
- Check for admin route in _app render
- only use that new dynamic component if isAdmin