diff --git a/src/PageComponents/HeadElements.php b/src/PageComponents/HeadElements.php index f20f2a88..f83d7114 100644 --- a/src/PageComponents/HeadElements.php +++ b/src/PageComponents/HeadElements.php @@ -13,7 +13,7 @@ class HeadElements /** * @return array */ - public static function create(): array + public static function create(string $contentRoot): array { $headElements = [ HtmlElement::meta() @@ -22,8 +22,14 @@ public static function create(): array $headElements = array_merge($headElements, Favicons::create()); + $cssPath = '/assets/css/main.min.css'; + // $filePath = $contentRoot . $cssPath; + // TODO: should be last commit of CSS file - another reason to place + // content in same folder as rest of project. + $query = round(microtime(true)); + $headElements[] = HtmlElement::link() - ->props('rel stylesheet', 'href /assets/css/main.min.css'); + ->props('rel stylesheet', "href {$cssPath}?{$query}"); return $headElements; } } diff --git a/src/Pages/DefaultTemplate.php b/src/Pages/DefaultTemplate.php index 255b098f..2342d8e8 100644 --- a/src/Pages/DefaultTemplate.php +++ b/src/Pages/DefaultTemplate.php @@ -61,7 +61,7 @@ public function body(): string return Document::create( $this->pageTitle() )->head( - ...HeadElements::create() + ...HeadElements::create($this->contentRoot) )->body( Element::a('menu')->props('href #main-nav', 'id content-top'), Element::article(