Example #1
0
 /**
  * Publish a source file and/or pass to $next.
  *
  * @param Source $source
  * @param Closure $next
  * @param array $excluded
  * @return mixed
  */
 public function handle(Source $source, Closure $next, ...$excluded)
 {
     foreach ($excluded as $pattern) {
         $value = str_contains($pattern, DIRECTORY_SEPARATOR) ? $source->getPathname() : $source->getFilename();
         if (str_is($pattern, $value)) {
             return;
         }
     }
     $next($source);
 }
Example #2
0
 /**
  * Check if this Source should be published by PHP (or left for gulp)
  *
  * @param Source $source
  * @param array $extensions
  * @return bool
  */
 protected function isPublishable(Source $source, array $extensions = ['php'])
 {
     return in_array($source->getExtension(), $extensions);
 }