Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to find windi.config.js file #291

Open
samadadi opened this issue Apr 8, 2022 · 2 comments
Open

unable to find windi.config.js file #291

samadadi opened this issue Apr 8, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@samadadi
Copy link

samadadi commented Apr 8, 2022

Describe the bug
unable to find windi.config.js file unless i specifically set config option to absolute path of windi.config.js file.
windi.config.js file is in same location as vite.config.js file. It is working but It just does not effect my configuration from windi.config.js file.

Versions

  • vite-plugin-windicss: ^1.8.3
  • vite: ^2.9.1
  • framework(vue/react/svelte/etc): solidjs

Additonal Context
vite-plugin-windicss configuration:

{
	scan: {
		dirs: ['.', 'src'],
		fileExtensions: ['html', 'js', 'jsx', 'ts', 'tsx']
	},
	config: path.resolve(__dirname, 'windi.config.js')
}

windi.config.js (Note: It's more than this simple configuration):


/**
 * 
 */
export default {
	theme: {
		extend: {
			
		}
	},
	shortcuts: {
		'bg-primary': {
			'@apply': 'bg-gray-50 dark:bg-gray-700',
			'&-active:active': {
				'@apply': 'bg-blue-300 dark:bg-cyan-700'
			},
			'&-hover:hover': {
				'@apply': 'bg-blue-100 dark:bg-cyan-800'
			},
			'&-muted': {
				'@apply': 'bg-gray-200 dark:bg-gray-600'
			}
		}
      }
}
@samadadi samadadi added the bug Something isn't working label Apr 8, 2022
@samadadi
Copy link
Author

samadadi commented Apr 8, 2022

without config or root options. plugin is unable to find windi.config.js file.

@ssendev
Copy link

ssendev commented Aug 28, 2022

I just spent way too much time until i realized windi.config.js is ignored.

In my case it was caused by having set root to web in vite.config.ts which then apparently causes windi to search its config in there. Setting WindiCSS({ config: "../windi.config.ts" }) was able to resolve it for me without absolute paths.

But i think windi should not search the config in root since no other config files moves when specifying it, or at least also try the default location if it's not found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants