Keeping Sage Updated

Hi,
I’ve reviewed the forums but am confused about the optimal way to keep Sage updated. My preference was to inherit sage somehow so my files vs. its were kept separate. So far, I’ve only seen keeping it separate via having it be a parent theme, or to combine my files and Sage together by creating it via Composer create-project, then use git sub-tree / etc. to manage it. The second approach doesn’t project an unknowing developer from changing a file that’s core, so it makes me a little nervous.

Are there other ways I didn’t find to leverage Sage but keep my files separate? Thanks!

This has come up a lot lately. Sage is a “starter” theme, not a theme framework or parent theme. It is designed to be modified, up to and including its core files, to build an effective and efficient custom theme for your site.

If a new feature in a Sage update is absolutely vital to your site, then yes it can be challenging to merge changes from the main repository, but given how bare-bones Sage is, this is a rare occurrence. Sage doesn’t have a ton of theme functionality out of the gate; you add that yourself during development. It’s not like Divi or Genesis where cool new stuff is being added all the time; Sage changes tend to be, like, cleaner error messages when yarn fails, or smarter auto-loading of .scss files during compilation.

I’ve been developing with Sage for years and I’ve never needed to merge changes from the source.

3 Likes

Lile @Milan_Chotai - i also would like to be able to work with the latest Sage.

I have tonnes of websites that use different versions of Sage and when i go back to them for Sprint jobs - i generally like to update them - but i’ve never really fully understood the best practices here.

On reading your response @MWDelaney - it seems to me that template wise - things don’t change that much which makes total sense

SO is it just the workflow that should be updated? ie update the composer.json (and composer update) and package.json (and yarn)? This would update all the dependencies would it not? I guess that resources/build would to be updated also?

This comes up a lot and the answer from us is always the same: you don’t need to update Sage, it is a starter theme

I’ve worked on projects that were pre-Sage (just Roots) and still don’t have issues with them working with newer versions of WordPress or any issues building the assets (switch to a compatible Node version first)

1 Like

I’m finding a couple of cases where an upgrade might be needed.

  1. Security. Github is now sending me warnings that my Sage 9 beta 4 based theme has severe security issues. This is probably not a huge issue, as far as I can tell it’s all dev stuff and nothing I ever push to a server. But that might not be true forever.

  2. Outdated packages. I’m increasingly getting issues where some older package or dependency is no longer available, or available packages no longer work as expected when I update PHP, add new packages, or CircleCI updates a container. I’ve had to hack around a bit to find the next available version that won’t break some other dependency.

I’d also like to use a newer Webpack, I suspect it’s conflicting with my Lando workflow, but I can’t because of the complex dependencies.

Ideally I’d love to rebase this whole theme on a newer Sage, or migrated to Sage 10 when its released. I expect I could move over Controller, CSS, JS, and template files to a new Sage without much issue, but it’s the modifications to core sage that might break this process. I’d need to diff core Sage 9 beta 4 files against my current working tree, then see how I’d apply those modifications to a fresh Sage 10.

I suspect this will have to be done eventually as a Sage 9 beta 4 workflow won’t work forever.

But basically we’re talking about a rebuild not an upgrade. This theme will be two years old soon and a rebuild might not be unreasonable at 3-4 years old.