コード例 #1
0
    public function testFindHelperMatches()
    {
        $content = <<<EOT
                <html>
                    <head>
                        {{ javascript_compiled('single.js') }}
                        <?php echo javascript_compiled(array(
                            'file1.js',
                            'file2.js'
                        )); ?>
                    </head>
                    <body>
                        <h1>Header</h1>                        
                        <?php echo javascript_compiled("double.js"); ?>
                        {{ javascript_compiled([
                            'file3.js',
                            'file4.js'
                        ]) }}
                    </body>
                </html>
EOT;
        $bundles = GCCompiler::findHelperMatches($content);
        $this->assertEquals(4, count($bundles));
        $this->assertEquals('single.js', $bundles[0][0]);
        $this->assertEquals('file1.js', $bundles[1][0]);
        $this->assertEquals('file2.js', $bundles[1][1]);
        $this->assertEquals('double.js', $bundles[2][0]);
        $this->assertEquals('file3.js', $bundles[3][0]);
        $this->assertEquals('file4.js', $bundles[3][1]);
    }
コード例 #2
0
ファイル: Build.php プロジェクト: jboysen/laravel-gcc
 /**
  *
  *
  * @return array
  */
 private function _getBundles()
 {
     $this->comment('Searching files...');
     $bundles = array();
     foreach (\File::allFiles(app_path('views')) as $file) {
         $this->getOutput()->write('.');
         foreach (\Jboysen\LaravelGcc\GCCompiler::findHelperMatches(\File::get($file)) as $bundle) {
             $bundles[] = $bundle;
         }
     }
     $this->getOutput()->writeln('Done!');
     return $bundles;
 }