Hostnet\Component\Webpack\Asset\Compiler::compile PHP Метод

compile() публичный Метод

public compile ( ) : string
Результат string
    public function compile()
    {
        $this->stopwatch->start('webpack.total');
        $this->stopwatch->start('webpack.prepare');
        // Recompile twig templates where its needed.
        $this->addSplitPoints();
        $this->addResolveConfig();
        // Write the webpack configuration file.
        file_put_contents($this->cache_dir . DIRECTORY_SEPARATOR . 'webpack.config.js', $this->generator->getConfiguration());
        $this->profiler->set('compiler.performance.prepare', $this->stopwatch->stop('webpack.prepare')->getDuration());
        $this->stopwatch->start('webpack.compiler');
        $this->process->run();
        $output = $this->process->getOutput() . $this->process->getErrorOutput();
        $this->profiler->set('compiler.executed', true);
        $this->profiler->set('compiler.last_output', $output);
        $this->profiler->set('compiler.successful', strpos($output, 'Error:') === false && strpos($output, 'parse failed') === false);
        // Finally, write some logging for later use.
        file_put_contents($this->cache_dir . DIRECTORY_SEPARATOR . 'webpack.compiler.log', $output);
        $this->profiler->set('compiler.performance.compiler', $this->stopwatch->stop('webpack.compiler')->getDuration());
        $this->profiler->set('compiler.performance.total', $this->stopwatch->stop('webpack.total')->getDuration());
        return $output;
    }

Usage Example

Пример #1
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->logger->info('[WEBPACK]: Compiling assets...');
     $this->compiler->compile();
     $this->logger->info('[WEBPACK]: Dumping assets...');
     $this->dumper->dump(new Filesystem());
     $this->logger->debug($this->profiler->get('compiler.last_output'));
 }
All Usage Examples Of Hostnet\Component\Webpack\Asset\Compiler::compile