当前位置: 首页>>代码示例>>PHP>>正文


PHP BladeCompiler::compile方法代码示例

本文整理汇总了PHP中Illuminate\View\Compilers\BladeCompiler::compile方法的典型用法代码示例。如果您正苦于以下问题:PHP BladeCompiler::compile方法的具体用法?PHP BladeCompiler::compile怎么用?PHP BladeCompiler::compile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\View\Compilers\BladeCompiler的用法示例。


在下文中一共展示了BladeCompiler::compile方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: fire

 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     // Set directories
     $inputPath = base_path('resources/views');
     $outputPath = storage_path('gettext');
     // Create $outputPath or empty it if already exists
     if (File::isDirectory($outputPath)) {
         File::cleanDirectory($outputPath);
     } else {
         File::makeDirectory($outputPath);
     }
     // Configure BladeCompiler to use our own custom storage subfolder
     $compiler = new BladeCompiler(new Filesystem(), $outputPath);
     $compiled = 0;
     // Get all view files
     $allFiles = File::allFiles($inputPath);
     foreach ($allFiles as $f) {
         // Skip not blade templates
         $file = $f->getPathName();
         if ('.blade.php' !== substr($file, -10)) {
             continue;
         }
         // Compile the view
         $compiler->compile($file);
         $compiled++;
         // Rename to human friendly
         $human = str_replace(DIRECTORY_SEPARATOR, '-', ltrim($f->getRelativePathname(), DIRECTORY_SEPARATOR));
         File::move($outputPath . DIRECTORY_SEPARATOR . sha1($file) . '.php', $outputPath . DIRECTORY_SEPARATOR . $human);
     }
     if ($compiled) {
         $this->info("{$compiled} files compiled.");
     } else {
         $this->error('No .blade.php files found in ' . $inputPath);
     }
 }
开发者ID:nerea91,项目名称:laravel,代码行数:40,代码来源:GettextCommand.php

示例2: compile

 public function compile($path = null)
 {
     if (str_contains($path, 'vendor/')) {
         preg_match('~/vendor/\\w+/([^/]+)~', $path, $matches);
         preg_match('~/([^/]+)$~', $path, $matches2);
         $name = $matches[1] . '::' . $matches2[1];
     } elseif (str_contains($path, 'resources/views/')) {
         $name = explode('resources/views/', $path)[1];
     } else {
         $name = explode('/views/', $path)[1];
     }
     $record = CoverageRecord::RecordEntry('View', '', $name);
     parent::compile($path);
 }
开发者ID:klsandbox,项目名称:laravelcoveragereport,代码行数:14,代码来源:CoverageBladeCompiler.php

示例3: fire

 public function fire()
 {
     $app = app();
     $cache = $app['path.storage'] . '/views';
     $compiler = new BladeCompiler($app['files'], $cache);
     // delete compiled
     $files = new \GlobIterator(TEMP_PATH . '/views/*');
     foreach ($files as $file) {
         if ($file->getExtension() !== '.gitignore') {
             unlink($file);
         }
     }
     // generate new ones
     $files = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(VIEWS_PATH), \RecursiveIteratorIterator::SELF_FIRST);
     foreach ($files as $file) {
         if ($file->getExtension() === 'blade') {
             $compiler->compile($file->getPathname());
         }
     }
 }
开发者ID:stanmay,项目名称:unflare,代码行数:20,代码来源:CompileViews.php

示例4: compile

 /**
  * Compile the view at the given path.
  *
  * @param string $path
  * @return void 
  * @static 
  */
 public static function compile($path = null)
 {
     \Illuminate\View\Compilers\BladeCompiler::compile($path);
 }
开发者ID:satriashp,项目名称:tour,代码行数:11,代码来源:_ide_helper.php


注:本文中的Illuminate\View\Compilers\BladeCompiler::compile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。