{"repo":"kucrut/vite-for-wp","free":true,"listed":false,"github":"https://github.com/kucrut/vite-for-wp","clone":"git clone https://github.com/kucrut/vite-for-wp.git","description":"Vite integration for WordPress plugins and themes development.","language":"PHP","stars":327,"topics":["vite","wordpress"],"license":"GPL-2.0","category":"self-hosted-apps","readme_excerpt":"Vite for WordPress Vite integration for WordPress plugins and themes development. Usage Let's assume we have this plugin files structure: JavaScript Add JS dependencies: Create vite.config.js : For multiple entrypoints, pass an object as the first parameter: Refer to Rollup documentation on how to set entrypoints: https://rollupjs.org/configuration-options/#input Feel free to customise the configuration to add plugins, use https, etc: Lastly, add dev and build scripts to your package.json : PHP Add the composer dependency: If your plugin/theme doesn't use composer, feel free to copy the main file and require it. Enqueue the script: Note that each entrypoint needs to be enqueued separately, ie. if you have multiple entrypoints, you'll need to call Vite\\enqueue asset() for each and every one of them. To only register the asset, use Vite\\register asset() . It accepts same parameters as Vite\\enqueue asset() and returns an array of scripts and styles handles that you can enqueue later using wp enqueue script() and wp enqueue style() . Please note that style assets are only registered in production mode because in development mode, they will be automatically loaded by Vite. You can now run npm run dev when developing your plugin/theme and run npm run build to build the production assets. Notes External Dependencies If your package depends on one or more scripts registered by WordPress (eg. jquery , react , @wordpress/i18n , etc.) and you want to exclude them from the final build, a","default_branch":null,"files":null,"tree":[],"storefront":"/r/kucrut","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/kucrut/vite-for-wp/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}