티스토리 뷰
<How to install TailwindCSS>
*laravel/framework -> 9.19, vite -> 3.0.0
Please refer to the official documentation (https://tailwindcss.com/docs/guides/laravel) and recommend to follow my guide if you failed that one.
1. Command the line below in the project directory.
# check if the libraries have been added to package.json
npm install -D tailwindcss postcss autoprefixer
# it generates "tailwind.config.js"
npx tailwindcss init
*Make sure that you already installed node.js for further installation.
2. Add contents that tailwind will apply to in tailwind.config.js.
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
'./resources/**/*.blade.php',
'./resources/**/*.js',
'./resources/**/*.vue',
],
theme: {
extend: {},
},
plugins: [],
}
3. Generate and configure postcss.config.js
* It should be located in the same level with tailwind.config.js.

4. Check plugins in vite.config.js.
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
export default defineConfig({
plugins: [
laravel({
input: ['resources/js/app.js'],
refresh: true,
}),
],
});
5. Import tailwind directives in app.css.
@tailwind base;
@tailwind components;
@tailwind utilities;
5. Import app.css in app.js
import './bootstrap';
import '../css/app.css';
6. Import tailwindcss-applied javascript file to the index php blade file with Vite.

7. npm run build
8. npm run dev
9. php artisan serve
🫠 Add "watch" script in your package.json (it concerns only vite) if you are willing to run 'watch' mode.

'Server > PHP' 카테고리의 다른 글
Laravel 9 Tutorial Summary I - Setup/Controller/Routing/Database (0) | 2022.09.27 |
---|---|
Variables & Conditionals & Loops & Functions (0) | 2022.08.01 |
- Total
- Today
- Yesterday
- mvvm
- laravel9
- retrofit_toJson()_error
- MultipleFirebaseEnvironments
- android_app_links
- unsplashAPI
- FlutterWirelessDebuginAOS
- retrofit_generator
- flutter
- flutter_android_app_links
- flutter_storage_not_working_for_the_first_time
- retrofit_generator_conflicts_with_freezed
- querydslKotlinError
- android_app_link_domain_works_with_adb_but_not_works_with_browser
- RunAFlutterProjectIniPhoneFromVSCode
- FirebaseConfigurationForMultipleBuildTypes
- Android
- futter_api
- KotlinFlow
- WirelessDebug
- flutter_secure_storage_issue_iOS
- Kotlin
- querydsl5.0.0jakarta
- AndroidWirelessDebug
- android_app_links_domain
- querydslQclass
- dagger-hilt
- Laravel
- phplaravel
- android_domain
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |