style updates
This commit is contained in:
@@ -13,14 +13,20 @@ final class ThemeHtmlBuilder
|
||||
public function stylesheet(?string $path = null): HtmlString
|
||||
{
|
||||
$path ??= $this->stylist->current()->stylesheet();
|
||||
if (! $this->stylist->current()->has($path)) return new HtmlString('');
|
||||
if (! $this->stylist->current()->has($path)) {
|
||||
return new HtmlString('');
|
||||
}
|
||||
|
||||
return new HtmlString('<link rel="stylesheet" href="'.e($this->url->asset($path)).'">');
|
||||
}
|
||||
|
||||
public function script(?string $path = null): HtmlString
|
||||
{
|
||||
$path ??= $this->stylist->current()->script();
|
||||
if (! $this->stylist->current()->has($path)) return new HtmlString('');
|
||||
if (! $this->stylist->current()->has($path)) {
|
||||
return new HtmlString('');
|
||||
}
|
||||
|
||||
return new HtmlString('<script src="'.e($this->url->asset($path)).'" defer></script>');
|
||||
}
|
||||
|
||||
@@ -32,11 +38,15 @@ final class ThemeHtmlBuilder
|
||||
|
||||
foreach ($theme->appearances() as $name => $definition) {
|
||||
$vars = (array) data_get($definition, 'variables', []);
|
||||
if ($vars) $rules[] = ':root[data-theme="'.$this->selector($name).'"]{'.$this->declarations($vars).'}';
|
||||
if ($vars) {
|
||||
$rules[] = ':root[data-theme="'.$this->selector($name).'"]{'.$this->declarations($vars).'}';
|
||||
}
|
||||
}
|
||||
foreach ($theme->accents() as $name => $definition) {
|
||||
$vars = (array) data_get($definition, 'variables', []);
|
||||
if ($vars) $rules[] = ':root[data-accent="'.$this->selector($name).'"]{'.$this->declarations($vars).'}';
|
||||
if ($vars) {
|
||||
$rules[] = ':root[data-accent="'.$this->selector($name).'"]{'.$this->declarations($vars).'}';
|
||||
}
|
||||
}
|
||||
|
||||
if ($theme->appearances() === [] && $theme->accents() === []) {
|
||||
|
||||
Reference in New Issue
Block a user