Skip to content

Commit 86f3655

Browse files
authored
Fix TailwindCSS v4 Vite build and compile assets (#211)
* Fix Vite build for TailwindCSS 4 and compile assets * Remove useLocalization to fix Vue crash
1 parent fc1ee48 commit 86f3655

9 files changed

Lines changed: 654 additions & 55 deletions

File tree

dist/css/tool.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/js/tool.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 641 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"name": "nova-command-runner",
23
"private": true,
34
"scripts": {
45
"dev": "vite build --watch",
@@ -8,6 +9,7 @@
89
"devDependencies": {
910
"@inertiajs/inertia": "^0.11.1",
1011
"@inertiajs/inertia-vue3": "^0.6.0",
12+
"@tailwindcss/vite": "^4.2.1",
1113
"@vitejs/plugin-vue": "^5.2.1",
1214
"@vue/compiler-sfc": "^3.5.13",
1315
"postcss": "^8.4.49",
@@ -17,4 +19,4 @@
1719
"autoprefixer": "^10.4.20",
1820
"tailwindcss": "^4.0.14"
1921
}
20-
}
22+
}

postcss.config.cjs

Lines changed: 0 additions & 6 deletions
This file was deleted.

resources/css/tool.css

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
@tailwind components;
2-
@tailwind utilities;
1+
@import "tailwindcss";

resources/js/pages/Tool.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,11 +302,14 @@
302302

303303
<script setup>
304304
import { ref, onMounted } from "vue";
305-
import { useLocalization } from "LaravelNova";
306305
import Button from "../components/Button.vue";
307306
import ToolbarButton from "../components/ToolbarButton.vue";
308307
309-
const { __ } = useLocalization()
308+
const __ = (key) => {
309+
return window.Nova && window.Nova.config && window.Nova.config('translations') && window.Nova.config('translations')[key]
310+
? window.Nova.config('translations')[key]
311+
: key;
312+
};
310313
const loading = ref(false);
311314
const playing = ref(false);
312315
const running = ref(false);

tailwind.config.js

Lines changed: 0 additions & 10 deletions
This file was deleted.

vite.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
import tailwindcss from "@tailwindcss/vite";
12
import vue from "@vitejs/plugin-vue";
23
import { resolve } from "path";
34
import { defineConfig } from "vite";
45

56
export default defineConfig({
6-
plugins: [vue()],
7+
plugins: [vue(), tailwindcss()],
78

89
define: {
910
"process.env": process.env, // Vite ditched process.env, so we need to pass it in

0 commit comments

Comments
 (0)