refactor(web): tailwind config use .env VITE_TAILWIND_BASE_FONT_SIZE

This commit is contained in:
Zack Spear
2024-10-02 17:00:03 -07:00
committed by Zack Spear
parent 648b560148
commit b5c525a9c2
2 changed files with 16 additions and 5 deletions
+4 -3
View File
@@ -1,6 +1,7 @@
VITE_ACCOUNT=https://localhost:8008
VITE_ACCOUNT=http://localhost:5555
VITE_CONNECT=https://connect.myunraid.net
VITE_UNRAID_NET=https://unraid.ddev.site
VITE_OS_RELEASES="https://releases.unraid.net/os"
VITE_CALLBACK_KEY=aNotSoSecretKeyUsedToObfuscateQueryParams
VITE_ALLOW_CONSOLE_LOGS=false
VITE_WEBGUI=http://localhost
VITE_ALLOW_CONSOLE_LOGS=true
VTIE_TAILWIND_BASE_FONT_SIZE=10
+12 -2
View File
@@ -1,5 +1,10 @@
import type { Config } from "tailwindcss";
import type { PluginAPI } from "tailwindcss/types/config";
import { readFileSync } from 'fs';
import { parse } from 'dotenv';
const envConfig = parse(readFileSync('.env'));
export default <Partial<Config>>{
safelist: [
"DropdownWrapper_blip",
@@ -200,6 +205,11 @@ export default <Partial<Config>>{
// eslint-disable-next-line @typescript-eslint/no-var-requires
plugins: [require("@tailwindcss/typography"), require('./utils/tailwind-rem-to-rem').default({
baseFontSize: 16,
newFontSize: 10
/**
* The font size where the web components will rendered in production.
* Required due to the webgui using the 62.5% font-size "trick".
* Set an env to 16 for local development and 10 for everything else.
*/
newFontSize: envConfig.VITE_TAILWIND_BASE_FONT_SIZE ?? 10,
})],
};
};