PHP code example of cleup / vite-php

1. Go to this page and download the library: Download cleup/vite-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

cleup / vite-php example snippets


// header.php
use Cleup\Foundation\Vite;

$vite = new Vite([
    /*
       Force development mode.
       By default, this parameter will change automatically depending on the state of the development server.
    */
    'dev' => false,

    /*
        The build directory (default: 'build')
    */
    'buildDir' => 'build',
]);

<head>
    ...
    <?= $vite->use('assets/js/app.js'); 

<head>
    ...
    <?= $vite->use('assets/js/app.js'); 

<head>
    ...
     /* The standard method */

<head>
    ...
    <?= $vite->use('assets/styles/root.css', [
        'type' => 'text/css'
    ]); 

<head>
    ...
    <?= $vite->use([
        'assets/js/app.js' => [
            'type' => 'text/css'
        ],
        'assets/js/app.js' => [
            'key' => 'value'
        ]
        'example.scss' // Standard attributes or those specified by the $attributes parameter will be used
    ]); 

composer