A practical question on how globals differ from Partials

The latest Developer Diaries have talked about globals and I had a question about how they may apply to one of my sites.

When I made my very first site on RW and Foundry I had an idea of changing the color of the navigation bar to match the color themes of each page on the site. I was told that if I used partials to do this there might be a flicker in the color of the navbar as it transitions from page to page.

Since I didn’t want there to be a strange glitch like that by just moving between pages I put a separate navigation bar on each page. This means that if I add or change a page I have to do change the link on all the pages 15 times over. I know that is insane but luckily I almost never change the pages on this site. I mostly tend to tinker with what is already there.

Would anything change in this area if I were to use Elements? Out of all of my sites the first one is the most likely candidate for being re-written. I do not think it is in really bad need of a re-write (it was already re-written once in 2021) but there are a few pages I would consider radically overhauling. If there ends up being an opening in my schedule I just may end up using my time that way.

I don’t know how partials work. But the flicker might be from CSS caching. Until the old CSS is replaced, the browsers might try to load the old. Having said that, I thing if there is a way to load a clear for those styled Globals before they load, that should eliminate any chance of a flicker. @dan @bon , what do you think?

2 Likes

I actually never really tried to set it up as a partial so I don’t know how bad it flickers. I just took my helps word for it that it acted that way. Maybe I should have tried it first!

Since I just spent a month rewriting it I was looking for the most trouble free route that was available to me at the time.

So yeah, if there is a way around this in the new software, like loading a clear I would be interested to see how that works. With my new work it is hard to know if I’ll end up rewriting a personal site with all the other things I’ve got to do but it just made me curious.

Maybe a CSS reset would work?

Hey @KipV,

Yup, this is easily doable in RapidWeaver Elements using Globals…

This won’t happen with Globals, as we generate all the required css you need and place it in one file.

You’re right, that is insane. Luckily we’ve made the Globals feature in Elements ridiculously powerful. You can easily override any setting on any global.

I cover your question in today’s Dev Diary video, here’s a direct link to that bit of the video.

Hope that helps!

1 Like

The great thing about Elements approach is that the CSS file is VERY small and it’s unique. So it is fast and will load fresh without the clearing and resets I mentioned. Awesome!

2 Likes

Thanks for making this video Dan! It appears to be just what I need it to do!

You’re welcome, and if you have any more questions please don’t hesitate to ask!

1 Like

Okay! I thought it would be interesting to rewrite this site but as I go back and look at it after a year I realize this site was bigger then I realized! I may just start with a new site fresh once Elements comes out.