PHP code example of psychowico / assets-compiler

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

    

psychowico / assets-compiler example snippets



#!/usr/bin/php


$_SERVER['argv'] = $argv = array_merge( $argv, array( 'minify' ) );
$_SERVER['argc'] = $argc = count($argv);



 echo $this->headLink()
                ->prependStylesheet($this->basePath() . '/css/bootstrap-responsive.min.css')
                ->prependStylesheet($this->basePath() . '/css/bootstrap.min.css')
                ->appendBundle('css_bundle')

echo $this->headScript()->prependFile($this->basePath() . '/js/bootstrap.min.js')
                        ->prependFile($this->basePath() . '/js/jquery.min.js')
                        ->prependBundle('js_bundle');
        


$this->prependJsBundle('js_bundle');
echo $this->headScript();

...
  'minifier'  => array(
    'js_adapter'  => array(
      'class'   => 'AssetsCompiler\Minifier\Adapter\UglifyJS2',
      'options' => array(
        'exec'  => '/uglifyjs2/path/or/link/',
        'flags' => array(
          .. //additional compiler flags
        ),
      ),
    ),
  )

...
  'flags' => array(
    '--comments' => '',
    '--define'   => 'DEBUG=false',
  ),
...