-
This is my config: // config.js
const { path } = require('@vuepress/shared-utils')
module.exports = {
theme: path.resolve(__dirname, './theme'),
postcss: {
plugins: [
require('tailwindcss'),
require('autoprefixer')
],
},
} // tailwind.config.js
module.exports = {
purge: [],
darkMode: false,
theme: {
extend: {},
},
variants: {
extend: {},
},
plugins: [],
} <!-- Layout.vue -->
<template>
<div class="italic">123</div>
</template>
<style lang="scss">
@tailwind base;
@tailwind components;
@tailwind utilities;
</style> |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 5 replies
-
Are you using v1 config in v2? // .vuepress/config.ts
import { defineUserConfig } from 'vuepress';
import type { WebpackBundlerOptions } from '@vuepress/bundler-webpack';
import type { DefaultThemeOptions } from '@vuepress/theme-default';
import { path } from '@vuepress/utils';
export default defineUserConfig<DefaultThemeOptions, WebpackBundlerOptions>({
bundlerConfig: {
postcss: {
postcssOptions: {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
},
},
},
} |
Beta Was this translation helpful? Give feedback.
-
I'm having an issue using Tailwind and setting the purge configuration.
However, if I include purge settings.
When I run a build and load the site the Tailwindcss is not applied. I'm app importing the tailwindcss into the /docs/.vuepress/styles/index.scss file and extending the default theme via the instructions provided in the documentation. |
Beta Was this translation helpful? Give feedback.
-
@Benbinbin It is a feasible way, but too troublesome, you can easily import the tailwindcss at once in
import { defineClientAppEnhance } from "@vuepress/client"
// Tailwind CSS
import "tailwindcss/tailwind.css"
export default defineClientAppEnhance((ctx) => {
// Your enhance code
})
// .vuepress/config.ts
import { defineUserConfig } from "@vuepress/cli"
import { path } from "@vuepress/utils"
import type { ThemeOptions } from "your-theme"
export default defineUserConfig<ThemeOptions>({
clientAppEnhanceFiles: path.resolve(__dirname, "clientAppEnhance.ts"),
}) |
Beta Was this translation helpful? Give feedback.
-
How about use the vite as bundler?
use this code as config can't work |
Beta Was this translation helpful? Give feedback.
-
@meteorlxy @nsznsznjsz Thanks a lot
|
Beta Was this translation helpful? Give feedback.
Are you using v1 config in v2?
postcss
is moved tobundlerConfig
if you are using webpack: