Next.js Discord

Discord Forum

CSS module best practice

Unanswered
Pyramid ant posted this in #help-forum
Open in Discord
Pyramid antOP
What is the best #CSS management in a Next.js project? Are Css modules a valid solution?

5 Replies

Pyramid antOP
I'm starting now with Next.js. and the first friction I had was with CSS modules. I'm not confortable in using {styles.sintax} it mess up my code. Are there other best practice?
Transvaal lion
I use css modules and it works pretty well for me. How does it mess up your code?
Pyramid antOP
I don't like the idea of using {styles.class} oject inside the jsx. (but I guss I should get use to it)

Another point: what folder structure do you use for your css.module?
- Do you store the file in the component folder or in the styles folder?

I'm not confident of using a style folder: if the project get bigger you could get lost.

Can be used css model inside the page/comps folder? is it a practice? (something like this)

- my_page_folder
index.js
My_page.module.css
Style folder structure
Pyramid antOP
Page folder structure