I have the following project.
vite.config.js
import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueDevTools from 'vite-plugin-vue-devtools'
import tailwindcss from '@tailwindcss/postcss';
import autoprefixer from 'autoprefixer';
// https://vite.dev/config/
export default defineConfig({
plugins: [
vue(),
vueDevTools(),
],
css: {
postcss: {
plugins: [
tailwindcss(),
autoprefixer(),
],
},
},
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
},
},
})
tailwind.config.js
export default {
content: [
"./index.html",
"./src/**/*.{vue,js,ts,jsx,tsx}",
],
theme: {
extend: {},
},
plugins: [],
}
src/main.js
import './assets/main.css'
import PrimeVue from "primevue/config";
import { createApp } from 'vue'
import App from './App.vue'
const app = createApp(App);
app.use(PrimeVue, {unstyled: true});
app.mount('#app');
src/App.vue
<script setup>
// import HelloWorld from './components/HelloWorld.vue'
// import TheWelcome from './components/TheWelcome.vue'
// import Panel from 'primevue/panel';
// import Button from 'primevue/button';
function onClick() {console.log("clock")};
</script>
<template>
<div class="p-4">
<h1 class="text-3xl font-bold underline">
Tailwind Test
</h1>
<p class="text-blue-500">This text should be blue.</p>
<button class="bg-green-500 text-white font-bold py-2 px-4 rounded" @click="onClick">
Click Me
</button>
<div class="text-red-500">This should be red</div>
</div>
</template>
<style scoped>
</style>
src/assets/main.css
@tailwind base;
@tailwind components;
@tailwind utilities;
I run
npm install
npm run dev
And see an unstyled page. What am I missing?
I am trying to set up Vue.js + PrimeVue unstyled + TailwindCSS.