PHP 8.3 버전 설치 (mac os 기준)
1. 설치
brew install php@8.3
2. 정상 설치 확인
php -v
라라벨 8 버전 프로젝트 생성 (composer 사용)
1. 프로젝트 생성
composer create-project --prefer-dist laravel/laravel:^8 my-laravel-project
2. 서버 실행
cd my-laravel-project
php artisan serve
3. 정상 설치 확인
http://127.0.0.1:8000/
tailwind css 설치(Laravel Mix 방식)
1. 설치
cd my-laravel-project
npm install -D tailwindcss postcss autoprefixer
npx tailwindcss init -p
2. /webpack.mix.js 수정
const mix = require('laravel-mix');
mix.js("resources/js/app.js", "public/js")
.postCss("resources/css/app.css", "public/css", [
require("tailwindcss"),
]);
3. /tailwind.config.js 수정
/** @type {import('tailwindcss').Config} */
export default {
content: [
"./resources/**/*.blade.php",
"./resources/**/*.js",
"./resources/**/*.vue",
],
theme: {
extend: {},
},
plugins: [],
}
4. /resources/css/app.css 수정
@tailwind base;
@tailwind components;
@tailwind utilities;
5. build process 시작
npm run watch
6. 정상 설치 확인
6-1. /resources/views/welcome.blade.php 수정
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
</head>
<body>
<h1 class="text-3xl font-bold underline">
Hello world!
</h1>
</body>
</html>
6-2. 확인
http://127.0.0.1:8000/
git 세팅
1. /.gitignore 수정
# Created by https://www.toptal.com/developers/gitignore/api/composer,laravel,visualstudiocode
# Edit at https://www.toptal.com/developers/gitignore?templates=composer,laravel,visualstudiocode
### Composer ###
composer.phar
/vendor/
# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
# composer.lock
### Laravel ###
node_modules/
npm-debug.log
yarn-error.log
# Laravel 4 specific
bootstrap/compiled.php
app/storage/
# Laravel 5 & Lumen specific
public/storage
public/hot
# Laravel 5 & Lumen specific with changed public path
public_html/storage
public_html/hot
storage/*.key
.env
Homestead.yaml
Homestead.json
/.vagrant
.phpunit.result.cache
### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets
# Local History for Visual Studio Code
.history/
# Built Visual Studio Code Extensions
*.vsix
### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide
# End of https://www.toptal.com/developers/gitignore/api/composer,laravel,visualstudiocode
2. git 디렉토리 생성
git init
3. 깃허브 연결
git remote add origin https://github.com/사용자명/저장소명.git
4. master 브런치 연결, 커밋, push
git push -u master master
git add .
git commit -m "
feat - 서버 기초 세팅
1. 라라벨 서버 세팅
2. tailwind css 라이브러리 세팅
3. tailwind ui 프레임워크 세팅
4. 깃허브 레포 세팅
"
git push
참고
- 라라벨코리아 8.x 문서
- tailwindcss 공식 문서
- 티스토리-집탱구리의 코드