css import with custom file name
Unanswered
Arboreal ant posted this in #help-forum
Arboreal antOP
In app route when I import style.css into layout, on build this file gets a random name like 7ub83a4b04ef4015.css and can be found in the _next/static/css folder. Is there a way I can add a fixed string to this file name? like string-7ub83a4b04ef4015.css?
9 Replies
@Arboreal ant In app route when I import style.css into layout, on build this file gets a random name like 7ub83a4b04ef4015.css and can be found in the _next/static/css folder. Is there a way I can add a fixed string to this file name? like string-7ub83a4b04ef4015.css?
no i don't think it's possible. why do you need to do this?
Arboreal antOP
I have multiple "standalone" folders (e.g. folderA, folderB) in my app folder. I need a way to distinguish which css file is used by which of these folders. For the js chunks it is easy since they are saved in the same structure (_nextjs/static/chunks/app/folderA and _nextjs/static/chunks/app/folderB)
ok interesting use case. i doubt it's possible to do this, i for sure don't know how to. you probably have more luck asking this as an issue in the nextjs repo
Arboreal antOP
I might just use inline css for the layout file then and not import any css
yeah, the use case is pretty specific for my case since I have multiple static sites generated by the same nextjs app
@!=tgt do NOT https://stackoverflow.com/questions/2612483/whats-so-bad-about-in-line-css
Arboreal antOP
thanks, you are correct. With inline I only meant to merge the global css file directly into layout.tsx (inline in the head part). Wouldn't see a problem with that - since the result is the same for the rest of the code
since it's not much css that I define in these files anyway (just some css vars and font definitions)