PHP code example of phaldan / asset-builder

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

    

phaldan / asset-builder example snippets


use Phaldan\AssetBuilder\AssetBuilder; 

$app = new AssetBuilder(); 

print $app->createProduction(__DIR__.DIRECTORY_SEPARATOR, 'assets/css')
  ->addGroups([
    "bundle.css" => $app->getGlobFileList([
      "assets/css/bootstrap.min.css", 
      "modules/*/css/*.css",
      "modules/*/css/*.scss", 
      "modules/*/css/*.less", 
    ]),
    "bundle.js" => $app->getGlobFileList([
      "assets/js/jquery.min.js", 
      "assets/js/bootstrap.min.js", 
      "modules/*/js/*.js",
    ])
  ])
  ->setCachePath(__DIR__.DIRECTORY_SEPARATOR.'tmp'.DIRECTORY_SEPARATOR) 
  ->execute($_GET["bundle"]);