0.0.3 • Published 5 months ago

cubex-vite-plugin v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

Cubex Vite Plugin

Introduction

Vite is a modern frontend tool that delivers an extremely fast development experience. It includes features like lightning-fast cold server start, instant hot module replacement, and optimized builds for production.

This plugin integrates Vite into Cubex to provide a seamless development experience.

This project is a modified version of the CodeIgniter Vite Plugin which in turn is based on the Laravel Vite Plugin

Installation

Install with composer:

composer require mressex/cubex-vite-plugin

Create a vite.config.js file in the root of your project:

// vite.config.js
import { defineConfig } from 'vite';
import cubex from "cubex-vite-plugin";

export default defineConfig({
    plugins: [
        cubex([
            'assets/scss/index.scss',
            'assets/ts/index.ts',
        ]),
    ],
});

Getting Started

  • Install your node dependencies: npm install
  • Start vite server: npm run dev

Add to the Cubex DI, also requires Dispatch to be setup

$cubex->share(Vite::class, $cubex->resolve(Vite::class, $ctx->getProjectRoot()));

Loading Your Scripts and Styles

Register and css or ts files in the vite.config.js file. The plugin will automatically load the files in the development environment and use the production build in the production environment.

pass true if you want to include the Vite client for Hot Mode Reloading

protected function _registerResources(Vite $vite): void
  {
    $vite(['assets/scss/index.scss', 'assets/ts/index.ts'], true);
  }
0.0.3

5 months ago

0.0.2

5 months ago

0.0.1

5 months ago