Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSSの技術選定におけるベストプラクティスが見つかっていない #23

Closed
Yuisei-Maruyama opened this issue Dec 20, 2021 · 2 comments
Labels
Closed Closed

Comments

@Yuisei-Maruyama
Copy link
Owner

Yuisei-Maruyama commented Dec 20, 2021

CSS Modulesのまま書き進めるか、CSS in JSに置き換えるのかを模索している状態。
メリット、デメリットを洗い出す。

@Yuisei-Maruyama Yuisei-Maruyama added the Todo Todo label Dec 20, 2021
@Yuisei-Maruyama Yuisei-Maruyama added Doing Doing and removed Todo Todo labels Jun 8, 2022
@Yuisei-Maruyama
Copy link
Owner Author

Yuisei-Maruyama commented Jun 8, 2022

CSSの記述方法には下記の2点が挙げられる。

  • Scss + CSS Modules : .scss をコンポーネントから import して使うことで scoped なスタイルとして使える手法

    • メリット: .scss をコンポーネントから import して使うことで scoped なスタイルとして使えること、既存の知識で運用できる

    • デメリット: スタイリングをするためにファイルを跨いで開発する必要がある。メンテナンスオンリーな状態にもあり、将来的に deprecate とされる可能性もある。

  • CSS in JS : その名のとおり JavaScript の中で CSS を書く手法。

    • メリット: JavaScript の中で CSS を書けるので、.tsx で完結できる。

    • デメリット: styled なラッパーコンポーネントが多く定義され、コードの可読性が低下する懸念がある。

@Yuisei-Maruyama
Copy link
Owner Author

Yuisei-Maruyama commented Jun 8, 2022

MUIが CSS in JSを採用しており、styled-componentsはMUIと親和性があり、かつ 多くの大手企業が採用しているので選定に説得力があり、キャッチアップとして良さそうに思えた。

https://mui.com/material-ui/guides/interoperability/#styled-components

スクリーンショット 2022-06-08 23 23 41

@Yuisei-Maruyama Yuisei-Maruyama added Closed Closed and removed Doing Doing labels Jun 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Closed Closed
Projects
None yet
Development

No branches or pull requests

1 participant