A simple Vite plugin for stripping PHP tags from JavaScript components.
You can install the plugin using your preferred package manager.
npm install -D @inertia-volt/vite
Next, import the inertiaVolt
plugin in your vite.config.js
file and add it to the plugins section:
import inertiaVolt from '@inertia-volt/vite'
export default defineConfig({
plugins: [
inertiaVolt({
path: 'resources/js/Pages', // Directory containing the components
extension: 'vue' // Specify the file extension (e.g., vue, tsx, jsx, svelte)
}),
],
});
The plugin searches for files within the specified path that match the .inertia.{extension} pattern. It then strips all valid PHP code from these files, leaving only the JavaScript component code.