Created
March 3, 2024 22:15
-
-
Save M-Drummond/cc90c2304f35d4a4e31fa8d08cbb2ba7 to your computer and use it in GitHub Desktop.
ViteJS Config for Wordpress Theme Dev
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import legacy from '@vitejs/plugin-legacy' | |
import ViteRestart from 'vite-plugin-restart'; | |
import 'dotenv/config' | |
import tailwindConfig from './tailwind.config'; | |
// https://vitejs.dev/config/ | |
export default ({ command }) => ({ | |
base: command === 'serve' ? '' : '/dist/', | |
build: { | |
manifest: true, | |
outDir: 'wp-content/themes/themedir/dist', | |
rollupOptions: { | |
input: { | |
app: 'src/js/app.ts', | |
}, | |
output: { | |
entryFileNames: `assets/[name].js`, | |
chunkFileNames: `assets/[name].js`, | |
assetFileNames: `assets/[name].[ext]` | |
} | |
}, | |
}, | |
css: { | |
postcss: { | |
plugins: [ | |
require('tailwindcss')({ | |
config: 'tailwind.config.js' | |
}) | |
] | |
} | |
}, | |
plugins: [ | |
// vue(), | |
legacy({ | |
targets: ['defaults', 'not IE 11'] | |
}), | |
ViteRestart({ | |
reload: [ | |
'wp-content/themes/themedir/**/*', | |
'wp-content/themes/themedir/*', | |
], | |
}), | |
], | |
}); | |
console.log('vite config loaded'); | |
console.log( tailwindConfig.content ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment