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

Human readable formatting for output #4

Closed
aivenkimmob opened this issue Jan 14, 2021 · 1 comment · Fixed by #6
Closed

Human readable formatting for output #4

aivenkimmob opened this issue Jan 14, 2021 · 1 comment · Fixed by #6

Comments

@aivenkimmob
Copy link
Contributor

Hello, thanks for the great library.

This is a feature request, would it be possible to add a flag for human readable output? I'm now running sed -i 's/" |/"\n |/g' types/tailwindGenerated.d.ts to make output look like this:

export type ClassNames = "-bottom-1"
  | "-bottom-1\/2"
  | "-bottom-1\/3"
  | "-bottom-1\/4"
  | "-bottom-1px"
  | "-bottom-2"
  | "-bottom-2\/3"
  // ... ~40 000 lines..
  | "z-auto";

Would you be willing to accept a PR that implements this feature and what should the option be named?

@esamattis
Copy link
Owner

Thanks!

PR is welcome for sure. I don't think this needs an option. I think it would be the best just to make the generation prettier by default in getTypeScriptType:

getTypeScriptType() {
const names = this.getClassNames()
.map(n => `"${n}"`)
.join(" | ");
return `${this.isModule ? 'export ' : ''}type ClassNames = ${names};`;
}

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

Successfully merging a pull request may close this issue.

2 participants