MiniAsset\Factory::compiler PHP Method

compiler() public method

Create an Compiler
public compiler ( boolean $debug = false ) : Compiler
$debug boolean Whether or not to enable debugging mode for the compiler.
return MiniAsset\Output\Compiler
    public function compiler($debug = false)
    {
        return new Compiler($this->filterRegistry(), $debug);
    }

Usage Example

 /**
  * Generate and save the cached file for a build target.
  *
  * @param MiniAsset\Factory $factory The factory class.
  * @param MiniAsset\AssetTarget $build The build target.
  * @return void
  */
 protected function _buildTarget($factory, $build)
 {
     $writer = $factory->writer();
     $compiler = $factory->compiler();
     $name = $writer->buildFileName($build);
     if ($writer->isFresh($build) && !$this->cli->arguments->defined('force')) {
         $this->verbose('<light_blue>Skip building</light_blue> ' . $name . ' existing file is still fresh.', 'S');
         return;
     }
     $writer->invalidate($build);
     $name = $writer->buildFileName($build);
     try {
         $this->verbose('<green>Saving file</green> for ' . $name, '.');
         $contents = $compiler->generate($build);
         $writer->write($build, $contents);
     } catch (Exception $e) {
         $this->cli->err('Error: ' . $e->getMessage());
     }
 }
All Usage Examples Of MiniAsset\Factory::compiler