Download the PHP package lukaskleinschmidt/kirby-laravel-vite without Composer

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

Kirby Laravel Vite

After installation, you can use the vite() helper to include Vite assets in your Kirby project. This plugin works best with the laravel-vite-plugin.

Note
Some features are not properly documented yet. Feel free to skim through the source code if you think something is missing.

Installation

Composer

Git Submodule

Download

Download and copy this repository to /site/plugins/laravel-vite.

Installing The Laravel Vite Plugin

Documentation for the Laravel Vite plugin can be found on the Laravel website.

Refreshing On Save

When your application is built using traditional server-side rendering, Vite can improve your development workflow by automatically refreshing the browser when you make changes to template or snippet files in your application. To get started, you can simply specify the refresh option.

Autoloading Template Specific Assets

If you used the @auto option for your assets, you can do the same with optional assets.

Optional Assets

When you use the Kirby Query Language or prepend an @ to an asset, those assets are treated as optional. Meaning the plugin will only include assets that actually exist at the given source path.

Note
Remember to include the optional assets in vite as well so that they are actually available once bundled. Assets not included in vite will work in development mode but not when bundled.

Custom Panel Scripts And Styles

Note Available since 1.1.0

You can use vite for your panel.css or panel.js too. Since the plugin requires the Kirby instance to work you need to define the assets in the ready callback to be able to use the vite() helper.

Note
Remember to include the optional panel assets in vite as well so that they are actually available once bundled. Assets not included in vite will work in development mode but not when bundled.

React

If you build your front-end using the React framework you will also need to call the additional vite()->reactRefresh() method alongside your existing vite() call.

The vite()->reactRefresh() method must be called before the vite() call.

Processing Static Assets With Vite

When referencing assets in your JavaScript or CSS, Vite automatically processes and versions them. In addition, when your application is built using traditional server-side rendering, Vite can also process and version static assets that you reference in your templates.

However, in order to accomplish this, you need to make Vite aware of your assets by importing the static assets into the application's entry point. For example, if you want to process and version all images stored in assets/images and all fonts stored in assets/fonts, you should add the following in your application's assets/js/app.js entry point:

These assets will now be processed by Vite when running npm run build. You can then reference these assets in your templates using the vite()->asset() method, which will return the versioned URL for a given asset:

Arbitrary Attributes

If you need to include additional attributes on your script and style tags, such as the data-turbo-track attribute, you may specify them via the plugin options.

If you need to conditionally add attributes, you may pass a callback that will receive the asset source path, its URL, its manifest chunk, and the entire manifest:

Note
The $chunk and $manifest arguments will be empty while the Vite development server is running.

Advanced Customization

Out of the box, Laravel's Vite plugin uses sensible conventions that should work for the majority of applications. However, sometimes you may need to customize Vite's behavior. To enable additional customization options, you can use the following options:

Note If you need access to the Kirby instance, you can use a callback function to define the option. Alternatively, you can configure Vite in Kirby's ready callback or directly in the template.

Within the vite.config.js file, you should then specify the same configuration:

Commercial Usage

This plugin is free if charge, but please consider a donation if you use it in a commercial project.

License

MIT

Credits

A good portion of the documentation has been copied from the Laravel website and adapted to the Kirby implementation.


All versions of kirby-laravel-vite with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
getkirby/composer-installer Version ^1.2
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 lukaskleinschmidt/kirby-laravel-vite contains the following files

Loading the files please wait ....