primevue-mirror/doc/tailwind/SetupDoc.vue

46 lines
1.9 KiB
Vue
Raw Normal View History

2023-07-09 21:13:49 +00:00
<template>
<DocSectionText v-bind="$attrs">
<p>
2023-08-01 10:23:12 +00:00
This section assumes that Tailwind is already available in your application, if not visit the Tailwind CSS <a href="https://tailwindcss.com/docs/installation/framework-guides">framework guides</a> like Vite or Nuxt for the installation.
2023-08-05 01:56:05 +00:00
The built-in default theme is basically a <PrimeVueNuxtLink to="/passthrough">global pass through</PrimeVueNuxtLink> configuration that needs to be imported from <i>primevue/passthrough/tailwind</i> path and then defined during setup.
Since the theme is exclusive to unstyled mode, the <i>unstyled</i> setting is required in addition.
2023-07-09 21:13:49 +00:00
</p>
2023-08-02 07:41:24 +00:00
<DocSectionCode :code="code1" hideToggleCode hideCodeSandbox hideStackBlitz />
<p>
Tailwind uses PurgeCSS internally to remove unused classes, since PrimeVue components are loaded from node_modules the <i>content</i> property at <i>tailwind.config.js</i> needs to be aware of PrimeVue, otherwise the classes utilized in
the theme will be removed as well.
</p>
<DocSectionCode :code="code2" hideToggleCode importCode hideCodeSandbox hideStackBlitz />
2023-08-01 10:23:12 +00:00
<p>Voilà 💚, you now have 90+ awesome Vue UI components styled with Tailwind that will work in harmony with the rest of your application.</p>
2023-07-09 21:13:49 +00:00
</DocSectionText>
</template>
2023-08-01 10:23:12 +00:00
<script>
export default {
data() {
return {
2023-08-02 07:41:24 +00:00
code1: {
2023-08-01 10:23:12 +00:00
basic: `import {createApp} from "vue";
import PrimeVue from "primevue/config";
2023-08-05 01:56:05 +00:00
import Tailwind from "primevue/passthrough/tailwind";
2023-08-01 10:23:12 +00:00
const app = createApp(App);
app.use(PrimeVue, { unstyled: true, pt: Tailwind });`
2023-08-02 07:41:24 +00:00
},
code2: {
basic: `export default {
...
content: [
"./index.html",
"./src/**/*.{vue,js,ts,jsx,tsx}",
"./node_modules/primevue/**/*.{vue,js,ts,jsx,tsx}"
],
...
}`
2023-08-01 10:23:12 +00:00
}
};
}
};
</script>