Notice
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |
Tags
- OOP
- TypeScript
- jest
- 기후변화
- url #querystring
- 객체참조 #객체
- 클로저
- ESLint
- #cloudfront #s3 #html 확장자 없애기
- lightsail nodejs apache
- NPM
- git pair
- this
Archives
- Today
- Total
Hello World...
Vue3.js 에서 tailwindcss 설치하기 (postcss 에러 났을 때) 본문
tailwindcss 공식홈페이지에 있는 내용대로 vite 를 설치해서 진행하면 문제가 없지만,
기존에 사용하던 vue3 에 추가하려니 아래와 같은 에러가 발생하여 설치가 제대로 되지 않았다.
Error: PostCSS plugin tailwindcss requires PostCSS 8.
찾아보니 해결책이 있었다. PostCSS 7 을 지원하는 다른 빌드로 설치를 하는 것 같다.
How to Setup Tailwind CSS in Vue 3 | Devjavu
How to Setup Tailwind CSS in Vue 3
A streamlined walkthrough if you hate docs so much.
devjavu.space
--------------------------------------------------------
- 기존에 설치한 것들을 삭제하고 아래 명령어대로 설치를 진행한다
# 기존에 설치한 의존성 삭제
npm uninstall tailwindcss postcss autoprefixer
# 삭제 후 아래 모듈 설치
npm install -D tailwindcss@npm:@tailwindcss/postcss7-compat @tailwindcss/postcss7-compat postcss@^7 autoprefixer@^9
# tailwind, postcss config 파일 생성
npx tailwindcss init -p
- tailwind.config.js 파일 purge 에 아래와 같이 작성.
module.exports = {
purge: ['./index.html', './src/**/*.{vue,js,ts,jsx,tsx}'],
darkMode: false, // or 'media' or 'class'
theme: {
extend: {},
},
variants: {
extend: {},
},
plugins: [],
};
- /src 폴더 밑에 styles 폴더를 만들고 app.css 파일을 만든다.
/* ./src/styles/app.css */
@tailwind base;
@tailwind components;
@tailwind utilities;
- main.js 에서 app.css 파일을 임포트한다.
import { createApp } from 'vue';
import App from './App.vue';
import router from './router';
import store from './store';
import './styles/app.css';
createApp(App).use(store).use(router).mount('#app');
- 정상적으로 적용되는 지 확인한다
<template>
<div>
<h1 class="font-bold underline">This is an about page</h1>
</div>
</template>
'vue.js' 카테고리의 다른 글
vite.config.js asset 폴더 이름 변경하기 (0) | 2022.11.15 |
---|---|
vue3, vue-router4 에서 base path 설정하기 (0) | 2022.10.26 |
nuxt2 base path 설정하기 (0) | 2022.10.25 |
Vue.js3 - fontawesome prefix 에러 나는 경우 (0) | 2022.02.26 |
Vuejs-TDD 메모 (0) | 2022.02.16 |
Comments