I thought I would write a tutorial on how you can host your SpaceHey templates on GitHub (or anywhere else), so you can use version control. Ultimately, it's kind of pointless, because even if you use an external CDN to serve up the CSS, SpaceHey will cache it, so every time you make a change, you will need to update the url to your file to break the cache. I thought I would share anyway.
First, you need to host your CSS file somewhere. I chose GitHub, but any CDN will do. You can also just add your CSS file to any existing website you have. Note that if you just create a repo and try and use the url directly, it won't work. On GitHub, I had to create a "GitHub Page", to access the CSS file as you would on a CDN. https://docs.github.com/en/pages/quickstart On your github website, you can just add the path to your file and copy it. In my case, I just made a "CDN" website to host files. In my case the path is: https://slafleche.github.io/cdn/spaceHeyTest.css.
The Code
Now edit your profile in SpaceHey. In the "About me" section, you will paste your code:
<style>
@import "https://slafleche.github.io/cdn/spaceHeyTest.css?cacheBust=1"
</style>
Cache busting
Internally, when you add an import in SpaceHey, they make a copy of it on their server and serve that version. That means that after you publish the first time, if you make changes on GitHub, they won't show on your page. That's why I added the "cacheBust=1" at the end there. Every time you pushed changes to your code, you need to update that string. For example, the second time you'd put something like: `@import "https://slafleche.github.io/cdn/spaceHeyTest.css?cacheBust=2"` then 3, 4 etc. The string doesn't matter, what matters is that it's unique. Does that make this whole thing kind of pointless? Yes it does. If SpaceHey wasn't caching your CSS, you wouldn't need to. However, doing this also ensure that anyone viewing your page doesn't see an old version cached on their computer either.
TLDR:
1. Host your CSS on a CDN
2. Import the CSS file in your about section
3. Bust the cache every update
Comments
Displaying 0 of 0 comments ( View all | Add Comment )