Skip to content
New issue

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

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

Already on GitHub? # to your account

Feature Request: Add option to serializer to fully strip SC classes #398

Open
Jasperrr91 opened this issue Feb 1, 2022 · 0 comments
Open

Comments

@Jasperrr91
Copy link

Hi there,

The provided serializer currently allows us to define two options:

  • whether or not we want to add styling
  • a formatter function to transform SC classnames into something more readable

For the projects in our organisation, we would like to be able to fully strip the classNames in snapshots/storyshots. The c0 c1 don't have any added value to us and result into bloating our merge requests with meaningless changes; at worst causing unnecessary merge conflicts.

We could provide a classNameFormatter that returns null, this however leaves us with 1 whitespace per styled component class. I would like to open a PR to add a third option stripClasses which if set to true will call stripUnreferencedClassNames instead of replaceClassNames/replaceHashes. Nothing more nothing less.

For now we're using a custom package which is basically a dumbed down version of the jest-styled-components/serializerwith this feature added; but we would prefer to stick to the official tooling. Hence this feature request.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant