Replies: 4 comments 3 replies
-
update on this? |
Beta Was this translation helpful? Give feedback.
-
I'm also trying to do this and haven't found a way |
Beta Was this translation helpful? Give feedback.
-
Trying to find a way to add dynamic stylesheets based on a theme as well. No luck so far, except just rendering the stylesheet inside the body with a Link. Unwanted behaviour, but does the trick. |
Beta Was this translation helpful? Give feedback.
-
I'm looking for the same thing. Please @leerob, could you check out this feature and provide some workaround to solve this limitation? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
Should be able to add stylesheets with current
Metadata
orgenerateMetadata
structureNon-Goals
No response
Background
There are several use cases that needs to dynamically add stylesheets, such as user-created theme, lots of font loading etc. Currently, there is a limited way to do this, by dynamically adding
<link>
tags in the root layout (apps/layout.ts
).Some of the use cases only requires to add
<link>
tags only on specific routes only. However, since the<head>
tag can be appear on the root layout only, so we are only able to add<link>
to all the routes.Take this example. This project is a CMS that allows user to upload a theme, and apply it to the site. User should be able to add custom fonts or custom CSS theme. All of those cannot be known at build time. The route handler in the
app/theme/route.ts
handles file I/O.However, since the loading of the custom fonts and the custom CSS theme is occuring on the root layout, the custom fonts and custom CSS is injected to all routes, which I don't want to do. (I don't want to allow custom fonts and custom CSS on admin routes).
Proposal
There are several ways to achieve this.
stylesheet
, with the type below.other
metadata prop to allow add not only<meta>
tags.<Head>
component.I'm willing to contribute, but unable to contribute before the discussion starts
Beta Was this translation helpful? Give feedback.
All reactions