public function findSplitPoints($template_file)
    {
        $inline_blocks = 0;
        $source        = new Source(file_get_contents($template_file), $template_file);
        $stream        = $this->twig->tokenize($source);
        $points        = [];

        while (! $stream->isEOF() && $token = $stream->next()) {
            // {{ webpack_asset(...) }}
            if ($token->test(Token::NAME_TYPE, 'webpack_asset')) {
                // We found the webpack function!
                $asset          = $this->getAssetFromStream($template_file, $stream);
                $points[$asset] = $this->resolveAssetPath($asset, $template_file, $token);
            }

            // {% webpack_javascripts %} and {% webpack_stylesheets %}
            if ($token->test(Token::BLOCK_START_TYPE) && $stream->getCurrent()->test(WebpackTokenParser::TAG_NAME)) {
                $stream->next();

                if ($stream->getCurrent()->getValue() === 'inline') {
                    $stream->next();

                    $token     = $stream->next();
                    $file_name = self::hashInlineFileName($template_file, $inline_blocks);

                    // Are we dealing with a custom extension? If not, fallback to javascript.
                    $extension = 'js'; // Default
                    if ($token->test(Token::NAME_TYPE)) {
                        $extension = $token->getValue();
                        $stream->next();
                    }

                    file_put_contents(
                        $this->cache_dir . '/' . $file_name . '.' . $extension,
                        $this->stripScript($stream->getCurrent()->getValue())
                    );

                    $asset       = $file_name . '.' . $extension;
                    $id          = 'cache/' . $asset;
                    $points[$id] = $this->resolveAssetPath($this->cache_dir . '/' . $asset, $template_file, $token);
                    $inline_blocks++;
                } else {
                    $stream->next();
                    while (! $stream->isEOF() && ! $stream->getCurrent()->test(Token::BLOCK_END_TYPE)) {
                        $asset          = $stream->expect(Token::STRING_TYPE)->getValue();
                        $points[$asset] = $this->resolveAssetPath($asset, $template_file, $token);
                    }
                }
            }
        }

        return $points;
    }
public function findSplitPoints($template_file)
    {
        $inline_blocks = 0;
        $source        = new Source(file_get_contents($template_file), $template_file);
        $stream        = $this->twig->tokenize($source);
        $points        = [];

        while (! $stream->isEOF() && $token = $stream->next()) {
            // {{ webpack_asset(...) }}
            if ($token->test(Token::NAME_TYPE, 'webpack_asset')) {
                // We found the webpack function!
                $asset          = $this->getAssetFromStream($template_file, $stream);
                $points[$asset] = $this->resolveAssetPath($asset, $template_file, $token);
            }

            // {% webpack_javascripts %} and {% webpack_stylesheets %}
            if ($token->test(Token::BLOCK_START_TYPE) && $stream->getCurrent()->test(WebpackTokenParser::TAG_NAME)) {
                $stream->next();

                if ($stream->getCurrent()->getValue() === 'inline') {
                    $stream->next();

                    $token     = $stream->next();
                    $file_name = self::hashInlineFileName($template_file, $inline_blocks);

                    // Are we dealing with a custom extension? If not, fallback to javascript.
                    $extension = 'js'; // Default
                    if ($token->test(Token::NAME_TYPE)) {
                        $extension = $token->getValue();
                        $stream->next();
                    }

                    file_put_contents(
                        $this->cache_dir . '/' . $file_name . '.' . $extension,
                        $this->stripScript($stream->getCurrent()->getValue())
                    );

                    $asset       = $file_name . '.' . $extension;
                    $id          = 'cache/' . $asset;
                    $points[$id] = $this->resolveAssetPath($this->cache_dir . '/' . $asset, $template_file, $token);
                    $inline_blocks++;
                } else {
                    $stream->next();
                    while (! $stream->isEOF() && ! $stream->getCurrent()->test(Token::BLOCK_END_TYPE)) {
                        $asset          = $stream->expect(Token::STRING_TYPE)->getValue();
                        $points[$asset] = $this->resolveAssetPath($asset, $template_file, $token);
                    }
                }
            }
        }

        return $points;
    }
public function findSplitPoints ( $ template_file ) { $ inline_blocks = 0 ; $ source = new Source ( file_get_contents ( $ template_file ) , $ template_file ) ; $ stream = $ this -> twig -> tokenize ( $ source ) ; $ points = [ ] ; while ( ! $ stream -> isEOF ( ) && $ token = $ stream -> next ( ) ) { // {{ webpack_asset(...) }} if ( $ token -> test ( Token :: NAME_TYPE , 'webpack_asset' ) ) { // We found the webpack function! $ asset = $ this -> getAssetFromStream ( $ template_file , $ stream ) ; $ points [ $ asset ] = $ this -> resolveAssetPath ( $ asset , $ template_file , $ token ) ; } // {% webpack_javascripts %} and {% webpack_stylesheets %} if ( $ token -> test ( Token :: BLOCK_START_TYPE ) && $ stream -> getCurrent ( ) -> test ( WebpackTokenParser :: TAG_NAME ) ) { $ stream -> next ( ) ; if ( $ stream -> getCurrent ( ) -> getValue ( ) === 'inline' ) { $ stream -> next ( ) ; $ token = $ stream -> next ( ) ; $ file_name = self :: hashInlineFileName ( $ template_file , $ inline_blocks ) ; // Are we dealing with a custom extension? If not, fallback to javascript. $ extension = 'js' ; // Default if ( $ token -> test ( Token :: NAME_TYPE ) ) { $ extension = $ token -> getValue ( ) ; $ stream -> next ( ) ; } file_put_contents ( $ this -> cache_dir . '/' . $ file_name . '.' . $ extension , $ this -> stripScript ( $ stream -> getCurrent ( ) -> getValue ( ) ) ) ; $ asset = $ file_name . '.' . $ extension ; $ id = 'cache/' . $ asset ; $ points [ $ id ] = $ this -> resolveAssetPath ( $ this -> cache_dir . '/' . $ asset , $ template_file , $ token ) ; $ inline_blocks ++ ; } else { $ stream -> next ( ) ; while ( ! $ stream -> isEOF ( ) && ! $ stream -> getCurrent ( ) -> test ( Token :: BLOCK_END_TYPE ) ) { $ asset = $ stream -> expect ( Token :: STRING_TYPE ) -> getValue ( ) ; $ points [ $ asset ] = $ this -> resolveAssetPath ( $ asset , $ template_file , $ token ) ; } } } } return $ points ; }
Returns an array of split points from the given template file.

@param  string $template_file
@return array
Returns an array of split points from the given template file .