Skip to content

How to use windicss in vuepress-next with vite #553

Answered by tennox
riderx asked this question in Q&A
Discussion options

You must be logged in to vote

Took me only 5 hours of debugging 🤓, I found the problem:

Windi was searching for files in .vuepress/.temp/vite-root which only had index.html 🤷

and the solution: 😎 (stupidly simple)

page/.vuepress/config.ts

import WindiCSS from 'vite-plugin-windicss'

module.exports = {
  bundlerConfig: {
    viteOptions: {
      plugins: [
        WindiCSS({
          root: __dirname, // default is .temp/vite-root
          scan: {
            dirs: ['.'], // default is ['src']
          },
        }),
      ],
    },
  },

page/.vuepress/clientAppEnhance.ts

import 'virtual:windi.css'
import 'virtual:windi-devtools'

// needs dummy export
import { defineClientAppEnhance } from '@vuepress/client'
export d…

Replies: 4 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@gotjoshua
Comment options

@tennox
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@riderx
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by riderx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants