PHP code example of motomedialab / laravel-vite-helper

1. Go to this page and download the library: Download motomedialab/laravel-vite-helper 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/ */

    

motomedialab / laravel-vite-helper example snippets


// will return the absolute compiled asset path for 'resources/css/app.css'
vite('resources/css/app.css');

// will return the absolute compiled asset path for
// 'resources/css/app.css' with custom build directory 'dist'
vite('resources/css/app.css', 'dist');

// the third argument enforces a relative path to be returned
vite('resources/css/app.css', 'build', true);

// the final argument allows you to force disable hot server mode and always return the manifest path
vite('resources/css/app.css', 'build', true, true);

// you can also use named arguments as below
vite('resources/css/app.css', buildDirectory: 'dist', relative: true, hotServer: true);

// and even supply an array to get an array of paths/URLs
vite(['resources/css/app.css', 'resources/js/app.js']);

class ExampleTest extends TestCase
{
    use MocksViteHelper;
    
    public function a_request_to_a_view_using_vite_helper()
    {
        $this->withoutViteHelper();

        $response = $this->get('/');

        $response->assertStatus(200);
    }
    
    public function restore_vite_helper_functionality()
    {
        $this->withViteHelper();

        $response = $this->get('/');

        $response->assertStatus(500);
    }
}