Skip to content

Laying the groundwork for good handling of unused CSS #1850

Open
@sungik-choi

Description

Description

애플리케이션에서 라이브러리의 Unused CSS를 잘 처리할 수 있는 환경을 마련해두자.

Reasons for suggestion

https://tailwindcss.com/docs/content-configuration#dynamic-class-names

The most important implication of how Tailwind extracts class names is that it will only find classes that exist as complete unbroken strings in your source files.

If you use string interpolation or concatenate partial class names together, Tailwind will not find them and therefore will not generate the corresponding CSS:

  • TailwindCSS와 같은 케이스처럼, PurgeCSS와 같은 unused CSS 처리 툴들을 잘 지원하려면 classname을 display && styles[display-${display}] 와 같이 사용하지 말아야 할 거 같습니다.
  • CSS Modules와 결합되었을 때 유의미한 일인지 체크해봐야합니다.

Proposed solution

컴포넌트가 Tree shaking 되었을 때, 애플리케이션의 최종 CSS에 포함되지 않은 컴포넌트의 CSS도 포함되는지 테스트가 필요함.

References

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    enhancementIssues or PR related to making existing features better

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions