| 1 | import { $ } from "bun"; |
| 2 | |
| 3 | // Clean up dist |
| 4 | await $`rm -rf site-dist`; |
| 5 | // Create new dist |
| 6 | await $`cp -r site site-dist`; |
| 7 | // Compile tailwindcss |
| 8 | await $`bunx @tailwindcss/cli -i ./site/input.css -o ./site-dist/output.css `; |
| 9 | |
| 10 | // Read index file |
| 11 | const htmlContent = await Bun.file("site-dist/index.html").text(); |
| 12 | // Update script tags and css link |
| 13 | const updatedHtml = htmlContent |
| 14 | .replace( |
| 15 | `<link rel="stylesheet" href="tailwindcss" />`, |
| 16 | `<link rel="stylesheet" href="output.css" />`, |
| 17 | ); |
| 18 | // Write file |
| 19 | await Bun.write("site-dist/index.html", updatedHtml); |
| 20 | |
| 21 | // Read feeds file |
| 22 | const feedsContent = await Bun.file("site-dist/feeds.html").text(); |
| 23 | // Update script tags and css link |
| 24 | const updatedFeedsHtml = feedsContent |
| 25 | .replace( |
| 26 | `<link rel="stylesheet" href="tailwindcss" />`, |
| 27 | `<link rel="stylesheet" href="/output.css" />`, |
| 28 | ); |
| 29 | // Write file |
| 30 | await Bun.write("site-dist/feeds.html", updatedFeedsHtml); |