Hostnet\Component\Webpack\Configuration\Plugin\UglifyJsPlugin::getCodeBlocks PHP Method

getCodeBlocks() public method

public getCodeBlocks ( )
    public function getCodeBlocks()
    {
        if (empty($this->config) || !$this->config['enabled']) {
            return [];
        }
        $compress = json_encode($this->config['compress']);
        $source_map = json_encode($this->config['source_map']);
        $test = $this->config['test'];
        $minimize = json_encode($this->config['minimize']);
        $mangle = !empty($this->config['mangle_except']) ? '{except:' . json_encode($this->config['mangle_except']) . '}' : 'false';
        $config = <<<CONFIG
{
    compress: {$compress},
    mangle: {$mangle},
    sourceMap: {$source_map},
    test: {$test},
    minimize: {$minimize}
}
CONFIG;
        return [(new CodeBlock())->set(CodeBlock::PLUGIN, sprintf('new %s(%s)', 'webpack.optimize.UglifyJsPlugin', $config))];
    }