본문 바로가기
Programming/Backend

[MAC M1] laravel + vuejs + vuetify 설치

by BitSense 2021. 3. 8.
반응형

php, laravel, vuejs, vuetify 설치

brew install php@7.3

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '756890a4488ce9024fc62c56153228907f1545c228516cbf63f885e036d37e9a59d27d63f46af1d4d07ee0f76181c7d3') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
mv composer.phar /usr/local/bin/composer

composer global require laravel/installer
composer global require laravel/valet

valet install

laravel new blog

cd blog

valet park
valet link
valet paths

composer require laravel/ui --dev
php artisan ui vue --auth

npm install & npm run dev
npm install -g @vue/cli

vue add vuetify

npm install @mdi/font -D
npm install moment vuex vue-router

프론트 페이지 추가

resources/views/vue.blade.php 추가

<!doctype html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- CSRF Token -->
    <meta name="csrf-token" content="{{ csrf_token() }}">

    <title>{{ config('app.name', 'Laravel') }}</title>

    <!-- Scripts -->
    <script src="{{ asset('js/app.js') }}" defer></script>

    <!-- Fonts -->
    <link rel="dns-prefetch" href="//fonts.gstatic.com">
    <link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet">

    <!-- Styles -->
    <link href="{{ asset('css/app.css') }}" rel="stylesheet">
</head>
<body>
<div id="app">
</div>
</body>
</html>

resources/js/views/App.vue 추가

<template>
<div>
    <h1>VUE Single page</h1>
</div>
</template>

<script>
export default {
name: "App"
}
</script>

<style scoped>

</style>

resources/js/app.js 수정

import Vue from 'vue';
import App from './views/App';

new Vue({
    render: h => h(App)
}).$mount('#app');

routes/web.php 소스 추가

Route::get('/vue', function () {
    return view('vue');
});

http://blog.test/vue 확인

반응형