PHP code example of rleeson / wp-webpack-loader

1. Go to this page and download the library: Download rleeson/wp-webpack-loader 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/ */

    

rleeson / wp-webpack-loader example snippets


use WPWebpackLoader\AssetLoader;
use WPWebpackLoader\Model\LoaderConfiguration;

// Define WPWEBPACK_DEV_ASSETS as a constant in wp-config.php
$assets = new AssetLoader( 
            home_url(), 
            WPWEBPACK_DEV_ASSETS,
            new LoaderConfiguration(
                function_to_get_version(),
                [ 'https://production-site.url/base' ]
            )
        );