Download the PHP package mrottow/vite-wordpress without Composer

On this page you can find all versions of the php package mrottow/vite-wordpress. 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-wordpress

vite logo

Vite PHP utilities for WordPress

Backend Utilities for vite-wordpress to integrate Vite's development server and HMR into WordPress, as well as manage the manifest file.

GitHub release Packagist Version GitHub last commit Packagist License

Features


Requirements


Installation

  1. Add the library to your project:

  2. Include the autoloader in your WordPress theme or plugin:

Usage

Dev Server

The DevServer class integrates the Vite development server with WordPress for HMR.

Example (uses default settings):

With custom settings:

When using the vite-wordpress ViteJS plugin, if files have been built using vite build, are enqueued and the development server is running via the vite command:

  1. DevServer automatically detects all enqueued scripts & templates from the project through hooks & vite-wordpress server configurations.
  2. It resolves scripts to source files served by the development server.
  3. It resolves templates to source files from the srcDir folder.
  4. It updates script tags from the project to use as modules and injects Vite's client to enable HMR (Hot Module Replacement).
  5. Using Vite's client and module support, it can also include CSS source files that are imported into JavaScript files.

It works for both JS and CSS entries.

It's compatible with a traditional setup with vite-wordpress without the need for a manifest or hashed files.

However, when using a manifest, the Manifest Resolver will assist in resolving the files through the manifest offering better precision for a more complex assets folder & file structure.

Manifest Resolver

The ManifestResolver class handles reading and accessing the Vite manifest file and additionally integrates into the dev server.

You can use the ManifestResolver instance, which needs to be wrapped in a function or helper class to work within hooks. Alternatively, you can use the Manifest facade, which handles this for you.

Example using the facade:

Example using the instance:

The manifest resolver is built off an interface so you're able to create your own implementation to include into the dev server.


Configuration

ManifestResolver

Method Default Description
set_manifest($path) ` | Sets the path to themanifest.jsonormanifest.php` file.
set_src($dir) 'src' (optional) Sets the source directory for the assets.

DevServer

Method Default Description
set_server_host($host) get_site_url() (optional) Sets the Vite dev server host.
set_server_port($port) 5173 (optional) Sets the Vite dev server port.
set_client_hook($priority) 5 (optional) Sets the priority for the Vite client hook.

Example

An example within a WordPress plugin can be found here: https://github.com/mrOttoW/vite-wordpress-plugin-block-example


All versions of vite-wordpress 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 mrottow/vite-wordpress contains the following files

Loading the files please wait ....