英文:
Should i import css into a next page?
问题
I want to ask if css can and should be imported into next pages.
is the page structure below acceptable, or what is the standard practice
/pages
/home
index.js
index.module.css
/cart
index.js
index.module.css
am i to move all the elements of a page that require styling into the components folder
英文:
I want to ask if css can and should be imported into next pages.
is the page structure below acceptable, or what is the standard practice
/pages
/home
index.js
index.module.css
/cart
index.js
index.module.css
am i to move all the elements of a page that require styling into the components folder
答案1
得分: 2
我会将样式放在它们自己的文件夹中,就像这样:
/pages
/home
index.js
/cart
index.js
/styles
home.module.css
cart.module.css
然后用 import homeStyles from '../styles/home.module.css'
导入。
英文:
I would put the styles in their own folder like this:
/pages
/home
index.js
/cart
index.js
/styles
home.module.css
cart.module.css
And then import with import homeStyles from '../styles/home.module.css
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论