Download the PHP package kucrut/vite-for-wp without Composer

On this page you can find all versions of the php package kucrut/vite-for-wp. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package vite-for-wp

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, add wp_scripts() to the list of Vite's plugins. But first, install the required dependencies:

For example, to externalise react and react-dom packages:

Special Notes for React

Example plugins

Limitations

Currently, this package doesn't provide HMR support for building editor blocks yet.

License

GPL v2


All versions of vite-for-wp with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package kucrut/vite-for-wp contains the following files

Loading the files please wait ....