From 20382a41d0680295f8a02109f1bd265e6722e971 Mon Sep 17 00:00:00 2001 From: Lev Myndra Date: Tue, 28 Mar 2023 14:30:25 +0300 Subject: [PATCH] Allow to import such utils as round, rem, em When a person wants to extend the typography config not only colors, e.g.: ``` extend: { typography: ({ theme }) => ({ lg: { css: { h1: { fontSize: em(38, 18), marginTop: '0', marginBottom: em(40, 48), lineHeight: round(48 / 48), }, }, }, ``` --- src/styles.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/styles.js b/src/styles.js index 105053d..454f0d8 100644 --- a/src/styles.js +++ b/src/styles.js @@ -1,12 +1,12 @@ const colors = require('tailwindcss/colors') -const round = (num) => +export const round = (num) => num .toFixed(7) .replace(/(\.[0-9]+?)0+$/, '$1') .replace(/\.0$/, '') -const rem = (px) => `${round(px / 16)}rem` -const em = (px, base) => `${round(px / base)}em` +export const rem = (px) => `${round(px / 16)}rem` +export const em = (px, base) => `${round(px / base)}em` let defaultModifiers = { sm: {