PHP code example of bojaghi / vite-scripts

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

    

bojaghi / vite-scripts example snippets


/**
 * Plugin Name: My Plugin
 *
 * /path/to/wp/wp-content/plugins/my-plugin/index.php (플러그인 메인 파일) 
 */

// ... 생략 ...
$vite = new \Bojaghi\ViteScripts\ViteScript(
    [
        'distBaseUrl'  => plugin_dir_url(__FILE__) . 'dist',
        'isProd'       => 'production' === wp_get_environment_type(),
        'manifestPath' => plugin_dir_path(__FILE__) . 'dist/.vite/manifest.json' 
    ],
);

$vite
    ->add('my-script', 'src/my-script.tsx')
    ->vars('myScript', ['name' => 'My React Script']);