Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Shivamyadav's avatar

Admin template is not working into the laravel ,vue with inertia?

Styles are breaking and vanilla js files any of them are not working properly. My app.js file

my vite.config

import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import laravel from "laravel-vite-plugin";
import path from "path";
import tailwindcss from "@tailwindcss/vite";

export default defineConfig({
    plugins: [
        laravel({
            input: [
                "resources/css/app.css", // Tailwind + custom CSS entry
                "resources/js/app.js",   // Main JS entry
            ],
            refresh: true,
        }),
        tailwindcss(),
        vue(),
    ],
    resolve: {
        alias: {
            "@": path.resolve(__dirname, "resources/js"),
            "@/components": path.resolve(__dirname, "resources/js/components"),
        },
    },
});

my app.blade.php file

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" />
        <meta http-equiv="X-UA-Compatible" content="ie=edge" />
        <title>BanCo - Dashboard</title>
        @vite(['resources/js/app.js',''])


        @inertiaHead
    </head>
    <body>
        <!-- layout start -->
        @inertia

        <!-- layout end -->


    </body>

    </html>

my ap.css

@import 'tailwindcss';
@import "tw-animate-css";

@custom-variant dark (&:is(.dark *));
@source '../../vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php';
@source '../../storage/framework/views/*.php';
@source '../**/*.blade.php';
@source '../**/*.js';

@theme {
  --color-red-800: #F7FAFC;
  --color-gray: #e7edf3;
  --color-sidebar: #fafafa;
  --color-navbar: #2C3E50;
  --color-button: #FF7043;
  --color-button-hover: #F4511E;
  --color-black: #263238;
  --color-accent: #FFD54F;
  --color-primary: #f5f5f5;
}

/* If you want external CSS libraries (like slick.css, aos.css) */
@import "../js/assets/css/slick.css";
@import "../js/assets/css/aos.css";
@import "../js/assets/css/output.css";
@import "../js/assets/css/style.css";
1 like
5 replies
vincent15000's avatar

The name of the page never starts with Auth/, here you include a part of the path.

For example for Auth/UsersPage.vue, the name is UsersPage.

Furthermore it would be more secure to load by default not the AdminLayout, but the AppLayout. I never load any admin informations except if I am sure that an admin is logged in.

Shivamyadav's avatar

Sorry for that. Thanks for pointing out, K will update it and thanks once again

1 like
malinda7's avatar

Hey! I ran into the same issue before. the problem usually comes from the admin template’s javascript not initializing properly with inertia.js. A simple fix is to make sure your template’s js runs after inertia mounts the app. you can do this by calling your template’s initialization function inside the setup of createInertiaapp or in a DOMContentLoaded listener. That usually gets everything working.

1 like
Shivamyadav's avatar

Could you please give an example how you have done with your code.

1 like
vincent15000's avatar

I think that if you were right, the problem would be the same with the app layout.

Please or to participate in this conversation.