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

More options/values for labelFormat #1559

Closed
kud opened this issue Oct 22, 2019 · 3 comments
Closed

More options/values for labelFormat #1559

kud opened this issue Oct 22, 2019 · 3 comments
Assignees
Milestone

Comments

@kud
Copy link

kud commented Oct 22, 2019

The problem

For the moment I use "labelFormat": "[dirname]-[filename]--[local]", but that's not enough for me.

Proposed solution

I would like that dirname takes all the folders.

Context

I'm here: /src/pages/Home/Main/Content.js with:

const Heading = styled.div``

class HomePageMainContent extends React.Component {}

I would like that the className generated for Heading is:

  • either xxx-HomePageMainContent--Heading (random-NameOfTheReactClass--NameOfTheLocal)
  • or xxx-pages-Home-Main-Content--Heading (random-The-Whole-Path--NameOfTheLocal)

Thank you :)

@Andarist
Copy link
Member

I agree that dirname for this is a little bit confusing, because usually dirname refers to the full path. Would you by any change have a better name for what is currently a dirname pattern? Maybe something like parentDir?

Anyway - I feel like we just can't satisfy all possible use cases and maybe we should just allow labelFormat to be a function? That way you could return whatever you want (based on filename).

@Andarist Andarist added this to the v11 milestone Oct 28, 2019
@emmatown
Copy link
Member

emmatown commented Nov 7, 2019

Anyway - I feel like we just can't satisfy all possible use cases and maybe we should just allow labelFormat to be a function? That way you could return whatever you want (based on filename).

I would be in favor of allowing this

@Andarist
Copy link
Member

This was implemented in #1651 and will be included in upcoming v11 release

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

No branches or pull requests

3 participants