phaldan/asset-builder

1.1.0 2017-11-29 13:15 UTC

This package is not auto-updated.

Last update: 2024-03-20 15:51:11 UTC


README

PHP library to define bundles based on dynamic lists of JavaScript and CSS files via glob. Additional features are JavaScript and CSS minification. Also supports LESS and SASS to CSS transformation.

Usage

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"]);