Skip to content

Transform displayName in config #404

Description

@otomad

Can we config the displayName form?

For example, if a styled component named StyledTabBar, we could transform it to tab-bar.

The config option could be like:

{
  plugins: [
    ["babel-plugin-styled-components", {
      transform: (displayName) => {
        return displayName
          .replace(/^Styled(?=[A-Z0-9])/, "")
          .replace(/(?<!^)([A-Z])/g, "-$1")
          .toLowerCase();
      }
    }]
  ]
}

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions