From 87cf9df68e49862daf19c5f52b8ed0cba2dd1ee7 Mon Sep 17 00:00:00 2001 From: Adam Wathan Date: Tue, 12 Mar 2019 21:28:27 -0400 Subject: [PATCH] Use configured monospace font for monospace elements --- __tests__/fixtures/tailwind-output-important.css | 14 ++++++++++++++ __tests__/fixtures/tailwind-output.css | 14 ++++++++++++++ src/plugins/css/preflight.css | 14 ++++++++++++++ 3 files changed, 42 insertions(+) diff --git a/__tests__/fixtures/tailwind-output-important.css b/__tests__/fixtures/tailwind-output-important.css index af532bc08..1f4628d3a 100644 --- a/__tests__/fixtures/tailwind-output-important.css +++ b/__tests__/fixtures/tailwind-output-important.css @@ -527,6 +527,20 @@ strong { font-weight: 700; } +/** + * Use the configured 'mono' font family for elements that + * are expected to be rendered with a monospace font, falling + * back to the system monospace stack if there is no configured + * 'mono' font family. + */ + +pre, +code, +kbd, +samp { + font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; +} + .container { width: 100%; } diff --git a/__tests__/fixtures/tailwind-output.css b/__tests__/fixtures/tailwind-output.css index 460ef4dee..3f554e0a7 100644 --- a/__tests__/fixtures/tailwind-output.css +++ b/__tests__/fixtures/tailwind-output.css @@ -527,6 +527,20 @@ strong { font-weight: 700; } +/** + * Use the configured 'mono' font family for elements that + * are expected to be rendered with a monospace font, falling + * back to the system monospace stack if there is no configured + * 'mono' font family. + */ + +pre, +code, +kbd, +samp { + font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; +} + .container { width: 100%; } diff --git a/src/plugins/css/preflight.css b/src/plugins/css/preflight.css index f3a5d5591..c6e9bfc54 100644 --- a/src/plugins/css/preflight.css +++ b/src/plugins/css/preflight.css @@ -172,3 +172,17 @@ textarea { strong { font-weight: theme('fontWeight.bold', bolder); } + +/** + * Use the configured 'mono' font family for elements that + * are expected to be rendered with a monospace font, falling + * back to the system monospace stack if there is no configured + * 'mono' font family. + */ + +pre, +code, +kbd, +samp { + font-family: theme('fontFamily.mono', SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace); +}