Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

How to point multiple Grav sites to web-root CSS?

Started by Muut Archive 10 years ago · 5 replies · 433 views
10 years ago

Hi! How can I point multiple Grav installations under same web root to fetch ONE 'custom.css' file? Right now in the twig partial, there's no way to get website root and put a custom CSS there only point to a custom file within the theme, or its there? Thnx!

10 years ago

just create a reference to the CSS with a hardcoded path. ie:

TXT
http://yoursite.com/css/custom.css
10 years ago

Thnx, I should have been clearer; we have to take in account http and https sites (dev and live) and also would like to know if there's a way of linking to root with 'assets.addCss' in partials?

10 years ago

Right now our dev site is http and the live site is https. This wouldn't be a problem taking care of with php, but I was under the impression there might be a twig way to get to site root?

10 years ago

{{ base_url_absolute }} should be the full base path with protocol.

10 years ago

Thanks for a fast reply! I'm getting 'website.com/blog/' with base_url_abs, but there are multiple Grav installations at 'website.com/', and ideally I'd like all those sites to share a 'custom.css' type stylesheet. This so I only have to compile one 'custom.css' file for all blogs. I guess I could move all Grav installations into one blog folder, but as of now the layout is 'website.com/blog01', 'website.com/blog02' etc. I thought there might be a way to address the very root of the site, not the separate Grav installation root. Maybe that's asking too much? The customer likes to have only one folder for CSS for the entire site, including all blogs. This to avoid confusion when updating. What would be the correct way ahead?

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1362 9 years ago
Archive · by Muut Archive, 9 years ago
2 939 9 years ago
Archive · by Muut Archive, 9 years ago
2 4069 9 years ago
Archive · by Muut Archive, 9 years ago
1 2959 9 years ago
Archive · by Muut Archive, 9 years ago
3 1124 9 years ago