Skip to content
Discussion options

You must be logged in to vote

Remix supports linked styles at the route level, but not at the component level. You can use CSS Modules for components.

For route-level CSS, do this in your route:

// routes/some-route.tsx
import styles from '~/styles/some-route.css?url'

export const links = [
  { rel: 'stylesheet', href: styles }
]

Remix will then add the <link> when you're on that route, and remove it when you navigate away.

NOTE: Nested routes will still keep the styles as long as the parent route is active.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@antonisprovidakis
Comment options

@kiliman
Comment options

Answer selected by antonisprovidakis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants