PHP code example of gears / asset

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

    

gears / asset example snippets


class RoboFile extends Robo\Tasks
{
    use Gears\Asset\loadTasks;
}

$this->taskBuildAsset('/where/do/you/want/me');

$this->taskBuildAsset('script.js')->source('styles.css')->run();

  $this->taskBuildAsset('built.js')->source('unbuilt.js')->run();
  

  $this->taskBuildAsset('built.css')->source('/my/styles')->run();
  

  $this->taskBuildAsset('built.js')->source
  ([
      '/js/jquery.js',
      '/js/jquery/plugins',
      '/js/main.js'
  ])->run();
  

  $this->taskBuildAsset('built.js')
  ->source
  (
      (new Finder)
        ->files()
          ->in('/path/to/assets')
          ->name('*.js')
          ->sortByName()
  )
  ->run();
  

  $this->taskBuildAsset(...)->source(...)->debug(true)->run();
  

  $this->taskBuildAsset(...)->source(...)->gz(true)->run();
  

  $this->taskBuildAsset(...)->source(...)->autoprefix(false)->run();
  

  $this->taskBuildAsset(...)->source(...)->template('view.html')->run();
  
RoboFile.php