PHP code example of weprovide / aviate-magento2

1. Go to this page and download the library: Download weprovide/aviate-magento2 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/ */

    

weprovide / aviate-magento2 example snippets




namespace NAMESPACE\MODULE\Plugin;

use WeProvide\Aviate\Magento2\Block\DevServer;

class AddReact
{
    public function afterGetFiles(
        DevServer $subject,
        $types
    ) {
        $aviate = $subject->aviate();
        $themePath = $aviate->getTheme()->getThemePath();

        if ($aviate->isDevMode()) {
            $types['js'][] = $aviate->getDevServerUrl($themePath . '/react.js');

            return $types;
        }

        $types['js'][] = $subject->getViewFileUrl('dist/' . $themePath . '/react.js');

        return $types;
    }
}