Download the PHP package offline/oc-vite-plugin without Composer
On this page you can find all versions of the php package offline/oc-vite-plugin. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package oc-vite-plugin
Vite ⚡integration for October CMS
This plugin provides simple integration of Vite for October CMS (Versions 3+).
Setup
Install the plugin using composer
For the Vite integration to work, you first need to set the VITE_MANIFEST
env variable to the path of the manifest file generated by Vite.
Then make sure to place the {% styles %}
and {% scripts %}
tags in your layout,
so assets are included correctly.
Configuring Vite
Install Vite via npm in your theme.
You can adapt the following Vite configuration to bundle your theme assets:
Workflow
- To use Vite in development, start the Vite server using the
vite
command - To build assets for production, use the
vite build
command
Including Vite Assets
Use the vite()
function anywhere in Twig to include assets from the Vite Dev Server or the Vite manifest.json
(depending on the environment).
You must provide an array of files to include as the first argument. All paths are relative to the theme directory.
By default, the vite()
function will output the required assets to your markup directly.
Using October's asset pipeline
If you want to push assets to October's asset pipeline instead, you can set the render
parameter to false.
No output will be generated where the vite()
function was called in this case.
Remember to place the {% styles %}
and {% scripts %}
tags in your layout, for this to work.
Passing in additional attributes
Any additional attributes will be passed to the generated HTML tag.
Including assets from PHP code
You can use a special vite:
token to include files in PHP:
The asset will now be included using October's asset pipeline and output wherever you have placed the {% scripts %}
and {% styles %}
tag.
Environments
Dev
By default, local
and dev
are regarded as dev environments. If your app environment is a dev environment,
the Vite Dev Server will automatically be included for you.
You can use the following .env
variables to configure how the Vite Dev Server is included:
Production
If your app is configured to be run in a production environment, the plugin will automatically use the Vite manifest to include assets.
All versions of oc-vite-plugin with dependencies
ext-json Version *
composer/installers Version ~1.0
october/rain Version ^3.0
laravel/framework Version ^9.0|^10.0