Skip to content

Commit cef5610

Browse files
committed
install tailwind css
1 parent 45c8c8d commit cef5610

18 files changed

+1889
-65
lines changed

app/Http/Controllers/HomeController.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,9 @@ public function about()
1616
{
1717
return Inertia::render('About');
1818
}
19+
20+
public function login()
21+
{
22+
return Inertia::render('Login');
23+
}
1924
}

package-lock.json

Lines changed: 1759 additions & 33 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 & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@
66
"build": "vite build"
77
},
88
"devDependencies": {
9+
"autoprefixer": "^10.4.14",
910
"axios": "^1.1.2",
1011
"laravel-vite-plugin": "^0.7.5",
12+
"postcss": "^8.4.25",
13+
"tailwindcss": "^3.3.2",
1114
"vite": "^4.0.0"
1215
},
1316
"dependencies": {

postcss.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export default {
2+
plugins: {
3+
tailwindcss: {},
4+
autoprefixer: {},
5+
},
6+
}

resources/css/app.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@tailwind base;
2+
@tailwind components;
3+
@tailwind utilities;

resources/js/Layouts/GuestLayout.vue

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<template>
2+
3+
<slot/>
4+
5+
</template>
6+
7+
<script>
8+
9+
</script>
10+
11+
<style scoped>
12+
13+
</style>

resources/js/Layouts/Layout.vue

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<template>
2+
<Header/>
3+
<slot/>
4+
<Footer/>
5+
</template>
6+
7+
<script setup>
8+
import Header from "@/Layouts/Partials/Header.vue";
9+
import Footer from "@/Layouts/Partials/Footer.vue";
10+
11+
</script>
12+
13+
<style scoped>
14+
15+
</style>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<template>
2+
<h3>Footer</h3>
3+
</template>
4+
5+
<script>
6+
7+
</script>
8+
9+
<style scoped>
10+
11+
</style>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<template>
2+
<div style="display: flex; justify-content: flex-start; gap: 10px;">
3+
<Link href="/" style="font-size: 20px;">Logo</Link>
4+
<NavLink name="Home" component="Home" href="/" />
5+
<NavLink name="About" component="About" href="/about" />
6+
<NavLink name="Login" component="Login" href="/login" />
7+
<form action="#">
8+
<input type="text" placeholder="Search...">
9+
</form>
10+
</div>
11+
12+
</template>
13+
14+
<script setup>
15+
import NavLink from "@/Components/NavLink.vue";
16+
import {Link} from "@inertiajs/vue3";
17+
18+
</script>
19+
20+
<style scoped>
21+
22+
</style>

resources/js/Pages/About.vue

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
<template>
2-
3-
<div style="display: flex; justify-content: flex-start; gap: 10px;">
4-
<NavLink name="Home" component="Home" href="/home" />
5-
<NavLink name="About" component="About" href="/about" />
6-
</div>
7-
82
<br>
93
<div>About page</div>
104
</template>
115

12-
<script setup>
13-
import NavLink from "@/components/NavLink.vue";
146

7+
<script>
8+
import Layout from "@/Layouts/Layout.vue";
9+
10+
export default {
11+
layout: Layout,
12+
}
1513
1614
</script>
1715

resources/js/Pages/Home.vue

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
11

22
<template>
33

4-
<div style="display: flex; justify-content: flex-start; gap: 10px;">
5-
<NavLink name="Home" component="Home" href="/home" />
6-
<NavLink name="About" component="About" href="/about" />
7-
</div>
8-
94
<br>
105
<div>Home Page</div>
116
<br>
127
<button @click.prevent="count--">-</button>
138
<span>{{ count}}</span>
149
<button @click.prevent="count++">+</button>
1510

16-
1711
</template>
1812

13+
<script>
14+
import Layout from "@/Layouts/Layout.vue";
15+
16+
export default {
17+
layout: Layout,
18+
}
19+
20+
</script>
21+
1922
<script setup>
2023
2124
import {ref} from "vue";
22-
import NavLink from "@/components/NavLink.vue";
2325
2426
const count = ref(0);
2527

resources/js/Pages/Login.vue

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<template>
2+
<br>
3+
<div>Login page</div>
4+
</template>
5+
6+
7+
<script>
8+
import GuestLayout from '@/Layouts/GuestLayout.vue';
9+
export default {
10+
layout: GuestLayout,
11+
}
12+
13+
</script>
14+
15+
<style scoped>
16+
17+
</style>

resources/js/app.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
import './bootstrap';
22
import { createApp, h } from 'vue'
33
import { createInertiaApp } from '@inertiajs/vue3'
4+
import Layout from "@/Layouts/Layout.vue";
45

56
createInertiaApp({
67
resolve: name => {
78
const pages = import.meta.glob('./Pages/**/*.vue', { eager: true })
8-
return pages[`./Pages/${name}.vue`]
9+
let page = pages[`./Pages/${name}.vue`]
10+
page.default.layout = page.default.layout ?? Layout
11+
return page
912
},
1013
setup({ el, App, props, plugin }) {
1114
createApp({ render: () => h(App, props) })

resources/views/app.blade.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
66
<title>Laravel Inertia and Vue practice</title>
77
@vite('resources/js/app.js')
8+
@vite('resources/css/app.css')
89
@inertiaHead
910
</head>
1011
<body>

routes/web.php

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,7 @@
33
use App\Http\Controllers\HomeController;
44
use Illuminate\Support\Facades\Route;
55

6-
/*
7-
|--------------------------------------------------------------------------
8-
| Web Routes
9-
|--------------------------------------------------------------------------
10-
|
11-
| Here is where you can register web routes for your application. These
12-
| routes are loaded by the RouteServiceProvider and all of them will
13-
| be assigned to the "web" middleware group. Make something great!
14-
|
15-
*/
166

17-
Route::get('/', function () {
18-
return view('welcome');
19-
});
20-
21-
Route::get('/home', [HomeController::class,'index'])->name('home.index');
7+
Route::get('/', [HomeController::class,'index'])->name('home.index');
228
Route::get('/about', [HomeController::class,'about'])->name('home.about');
9+
Route::get('/login', [HomeController::class,'login'])->name('home.login');

tailwind.config.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/** @type {import('tailwindcss').Config} */
2+
module.exports = {
3+
content: [
4+
"./resources/**/*.blade.php",
5+
"./resources/**/*.js",
6+
"./resources/**/*.vue",
7+
],
8+
theme: {
9+
extend: {},
10+
},
11+
plugins: [],
12+
}

vite.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import vue from '@vitejs/plugin-vue'
44

55
export default defineConfig({
66
plugins: [
7-
vue(),
87
laravel({
98
input: ['resources/css/app.css', 'resources/js/app.js'],
109
refresh: true,
1110
}),
11+
vue(),
1212
],
1313
});

0 commit comments

Comments
 (0)