我应该将 CSS 导入到下一页吗?

huangapple go评论76阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2023年4月16日 23:11:05
  • 转载请务必保留本文链接:https://go.coder-hub.com/76028566.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定