PHP code example of elephfront / robo-import-js

1. Go to this page and download the library: Download elephfront/robo-import-js 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/ */

    

elephfront / robo-import-js example snippets


use Elephfront\RoboImportJs\Task\Loader\LoadImportJavascriptTasksTrait;

class RoboFile extends Tasks
{

    use LoadImportJavascriptTasksTrait;
    
    public function concatJavascript()
    {
        $this
            ->taskImportJavascript([
                'assets/js/main.js' => 'assets/min/js/main.min.js',
                'assets/js/home.js' => 'assets/min/js/home.min.js',
            ])
            ->run();
    }
}

$data = [
    'path/to/source/file' => [
        'js' => '// Some javascript code',
        'destination' => 'path/to/destination/file
    ]
];

$this
    ->taskImportJavascript([
        'assets/js/main.js' => 'assets/min/main.min.js',
        'assets/js/home.js' => 'assets/min/home.min.js',
    ])
        ->disableWriteFile()
    ->someOtherTask()
    ->run();