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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggested String Template Example #238

Closed
wants to merge 1 commit into from

Conversation

justsml
Copy link

@justsml justsml commented Dec 25, 2017

Here's a pattern I've been using lately.
Let me know if you think it might be useful to others. 馃憤

Here's a pattern I've been using lately.
@sindresorhus
Copy link
Member

Thanks, but we don't consider that a good pattern as the color names are not clear when taken out of context. Suddenly you have a function called red deep inside some code path without realizing it's connected to Chalk. This will also not work with ES2015 modules as Chalk is a default export and the colors are not exported individually.

Relevant comment: #215 (comment)

@justsml
Copy link
Author

justsml commented Dec 26, 2017

Why can't the color functions be exported individually? You don't need to use them, and you can alias them as needed in the import.

Sure, color names may be confusing or out of context in a game, or css-in-js module.
But for 90% of the work I do, it's definitely obvious red() is connected to chalk when it's on every line like:

log(red`FAIL :facepalm:`)

Happy Xmas Sindre!

Thanks for all you do!

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 this pull request may close these issues.

None yet

2 participants