/**
  * Generate a compiled asset, with all the configured filters applied.
  *
  * @param AssetTarget $target The target to build
  * @return The processed result of $target and it dependencies.
  * @throws RuntimeException
  */
 public function generate(AssetTarget $build)
 {
     $filters = $this->filterRegistry->collection($build, $this->debug);
     $output = '';
     foreach ($build->files() as $file) {
         $content = $file->contents();
         $content = $filters->input($file->path(), $content);
         $output .= $content . "\n";
     }
     $output = $filters->output($build->path(), $output);
     return trim($output);
 }
Esempio n. 2
0
 /**
  * Generate a compiled asset, with all the configured filters applied.
  *
  * @param AssetTarget $target The target to build
  * @return The processed result of $target and it dependencies.
  * @throws RuntimeException
  */
 public function generate(AssetTarget $build)
 {
     $filters = $this->filterRegistry->collection($build);
     $output = '';
     foreach ($build->files() as $file) {
         $content = $file->contents();
         $content = $filters->input($file->path(), $content);
         $output .= $content . "\n";
     }
     if (!$this->debug || php_sapi_name() === 'cli') {
         $output = $filters->output($build->path(), $output);
     }
     return trim($output);
 }