Hostnet\Component\Webpack\Configuration\Loader\CoffeeScriptLoader::getCodeBlocks PHP Метод

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

public getCodeBlocks ( )
    public function getCodeBlocks()
    {
        $config = $this->config['loaders']['coffee'];
        if (!$config['enabled']) {
            return [new CodeBlock()];
        }
        return [(new CodeBlock())->set(CodeBlock::LOADER, sprintf("{ test: /\\.coffee/, loader: '%s' }", $config['loader']))];
    }

Usage Example

 public function testGetCodeBlock()
 {
     $config = new CoffeeScriptLoader(['loaders' => ['coffee' => ['enabled' => true, 'loader' => 'coffee']]]);
     $block = $config->getCodeBlocks()[0];
     $this->assertTrue($block->has(CodeBlock::LOADER));
 }