Skip to content

Commit 4059823

Browse files
committed
pretty print messages with new lines
Before this change, the output looked like this: ``` │ No input stylesheets provided. Searching for CSS files in the current directory and its subdirectories… │ Error: Cannot find a CSS file where Tailwind CSS is setup. Make sure to create a CSS file where Tailwind CSS is setup and try again. ``` After this change, it looks like this: ``` │ No input stylesheets provided. Searching for CSS files in the current directory and its subdirectories… │ Error: Cannot find a CSS file where Tailwind CSS is setup. │ Make sure to create a CSS file where Tailwind CSS is setup and try again. ```
1 parent a77a7b1 commit 4059823

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/@tailwindcss-upgrade/src/utils/renderer.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,13 @@ export function relative(
4040
/**
4141
* Wrap `text` into multiple lines based on the `width`.
4242
*/
43-
export function wordWrap(text: string, width: number) {
43+
export function wordWrap(text: string, width: number): string[] {
44+
// Handle text with newlines by maintaining the newlines, then splitting
45+
// each line separately.
46+
if (text.includes('\n')) {
47+
return text.split('\n').flatMap((line) => wordWrap(line, width))
48+
}
49+
4450
let words = text.split(' ')
4551
let lines = []
4652

0 commit comments

Comments
 (0)