/** * addStylesheet method * * @param $name * @param $src * @param array $depends * @param bool $external * * @return static */ public function addStylesheet($name, $src, array $depends = [], $external = false) { $src = Str::ensureRight($src, '.css'); $src = $external ? $src : asset($src); $this->stylesheets->put($name, compact('src', 'depends', 'external', 'name')); return $this; }
protected function resolveRefs() { // Scan refs (directories) and instaniate / add em to the collection $directories = $this->getFiles()->directories(); foreach ($directories as $directory) { /** @var Ref $ref */ $ref = $this->app->make('codex.ref', ['name' => $directory, 'project' => $this->project, 'refs' => $this]); $this->items->put($directory, $ref); // if the ref is a (semver) version, we add it to versions, so we can easily reference it laster (sort etc) if ($ref->isVersion()) { $this->versions[] = $ref; } elseif ($ref->isBranch()) { $this->branches[] = $ref; } } // Resolve default ref $defaultRef = $this->items->first()->getName(); // DEFAULT_FIRST_DIRECTORY switch ($this->project->config('default')) { case static::DEFAULT_AUTO: break; case static::DEFAULT_MASTER: $defaultRef = 'master'; break; case static::DEFAULT_LAST_VERSION: $defaultRef = collect($this->versions)->sort(function (Ref $one, Ref $two) { return version::gt($one->getVersion(), $two->getVersion()) ? -1 : 1; })->first()->getName(); break; case static::DEFAULT_FIRST_DIRECTORY: $defaultRef = $this->items->first()->getName(); break; case static::DEFAULT_CUSTOM: $defaultRef = $this->project->config('custom'); break; } $this->default = (string) $defaultRef; }