Skip to content

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

Description

@Jasperrr91

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions