Skip to content

Commit

Permalink
chore: migrate gpa-calculator to tailwind 4
Browse files Browse the repository at this point in the history
And off of the play CDN.

Unfortunately, Fontaine has issues with Tailwind’s generated styles, see unjs/fontaine#446.

Also, @tailwindcss/forms is really ugly with our styles.

Fixes: #5.
  • Loading branch information
lishaduck committed Jan 19, 2025
1 parent e1e931a commit 7dbf37f
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 16 deletions.
7 changes: 3 additions & 4 deletions apps/gpa-calculator/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
<meta name="viewport" content="width=device-width" />
<title>GPA Calculator</title>
<script type="module" src="/src/script.ts"></script>
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="bg-[url('/bground.png')]" onload="startApp()">
<!-- The overlay -->
Expand Down Expand Up @@ -35,7 +34,7 @@

<div class="main">
<div
class="borderwhite border-b-1 grid grid-cols-6 gap-4 border border-l-0 border-r-0 border-t-0 bg-black p-8 text-white lg:w-1/3 lg:p-2"
class="border-b-1 grid grid-cols-6 gap-4 border border-l-0 border-r-0 border-t-0 bg-black p-8 text-white lg:w-1/3 lg:p-2"
>
<button
type="button"
Expand Down Expand Up @@ -87,11 +86,11 @@ <h5>How to use!</h5>
type="number"
placeholder="Number of Classes"
id="numOfClasses"
class="mt-3 rounded-sm pl-1 text-black"
class="rounded-xs mt-3 pl-1 text-black"
/>
<button
onclick="classAmount()"
class="rounded-sm px-1 text-black"
class="rounded-xs px-1 text-black"
type="submit"
>
Submit
Expand Down
2 changes: 2 additions & 0 deletions apps/gpa-calculator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
},
"devDependencies": {
"@psdtools/tsconfig": "workspace:^",
"@tailwindcss/vite": "4.0.0-beta.9",
"@total-typescript/ts-reset": "^0.6.1",
"@vite-pwa/assets-generator": "^0.2.6",
"browserslist": "^4.24.4",
Expand All @@ -47,6 +48,7 @@
"fontaine": "^0.5.0",
"jiti": "^2.4.2",
"lightningcss": "^1.29.1",
"tailwindcss": "4.0.0-beta.9",
"typescript": "~5.7.3",
"vite": "^6.0.7",
"vite-plugin-html-minifier": "^1.0.5",
Expand Down
5 changes: 3 additions & 2 deletions apps/gpa-calculator/src/styles/global.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import "tailwindcss";

html,
body {
height: 100%;
Expand All @@ -11,8 +13,7 @@ body {
}

body {
font-family: Norwester, "Norwester fallback", Verdana, Geneva, Tahoma,
sans-serif;
font-family: Norwester, "Norwester fallback";
}

button {
Expand Down
4 changes: 0 additions & 4 deletions apps/gpa-calculator/tailwind.config.ts

This file was deleted.

13 changes: 8 additions & 5 deletions apps/gpa-calculator/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import tailwindcss from "@tailwindcss/vite";
import browserslist from "browserslist";
import browserslistToEsbuild from "browserslist-to-esbuild";
import { FontaineTransform } from "fontaine";
import { browserslistToTargets } from "lightningcss";
import { defineConfig } from "vite";
import htmlMinifier from "vite-plugin-html-minifier";
Expand All @@ -27,10 +27,13 @@ export default defineConfig({
transformer: "lightningcss",
},
plugins: [
FontaineTransform.vite({
fallbacks: ["Verdana", "Geneva", "Tahoma", "sans-serif"],
resolvePath: (path) => new URL(`.${path}`, import.meta.url),
}),
tailwindcss(),
// See unjs/fontaine#446.
// FontaineTransform.vite({
// fallbacks: ["Verdana", "Geneva", "Tahoma", "sans-serif"],
// // Convert an absolute paths to be relative to the root.
// resolvePath: (path) => new URL(`.${path}`, import.meta.url),
// }),
htmlMinifier({
minify: true,
}),
Expand Down
2 changes: 1 addition & 1 deletion knip.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"entry": ["src/{script,sw}.ts"],
"project": ["**/*.{js,cjs,mjs,ts,cts,mts}"],
"ignore": ["eslint.config.ts", "tailwind.config.ts"],
"ignoreDependencies": ["deputy"]
"ignoreDependencies": ["deputy", "fontaine"]
},
"apps/petal-notes": {
"ignore": [".storybook/vitest.setup.ts", "eslint.config.ts"],
Expand Down
6 changes: 6 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions project_words.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
fontaine
Fontaine
fontawesome
fortawesome
Expand All @@ -8,6 +9,7 @@ Pattonville
remeda
storybookjs
Tahoma
unjs
vanillajs
Verdana
Xmark

0 comments on commit 7dbf37f

Please sign in to comment.