Last active
October 19, 2020 05:25
-
-
Save chimericdream/28dabb0c0111c3c43e6553c67ac2057c to your computer and use it in GitHub Desktop.
Chalk issue with string from a file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const chalk = require('chalk'); | |
const fs = require('fs'); | |
const inline = chalk`{red.bold this is a test} | |
{green with multiple} {white.bold colors and} | |
{magenta lines}`; | |
const fromFile = fs.readFileSync('./message.txt', 'utf8'); | |
console.log(inline); | |
console.log('----------------------'); | |
console.log(chalk`${fromFile}`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{red.bold this is a test} | |
{green with multiple} {white.bold colors and} | |
{magenta lines} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "chalk-test", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "", | |
"license": "ISC", | |
"dependencies": { | |
"chalk": "^4.1.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment