Sage 9, beginner's questions

Hi everyone, sorry for the weird question - I am a beginner, had been working with usual wp development without composer. Could you please clarify some bits for me.

  1. let’s say I have a client, and their theme is developed by someone else, with sage 9. To do small amends to style, or create a new template for a page - do I need to download everything, setup webpack, local wordpress, and compile? Seems too complicated.
  2. could you advise any good video tutorials for Sage?

The short answer is yes.

The recommended workflow for Sage (and all of the Roots stack) is to develop locally, track your changes in a git repo, and deploy your changes to production when necessary. Not all changes necessarily require a functioning local WordPress installation, nor do all changes require building new assets, but all changes should be tracked in git. Why you should track your work with git is a big question, largely beyond the scope of a forum response, but the short version is: It makes your life easier, safer, and more mistake-resistant.

If you haven’t already, I’d recommend reading through the docs on compiling assets: https://roots.io/docs/sage/9.x/compiling-assets/ In short, though, the Sage build process generates optimized, minified styles and scripts, and those are what WordPress ultimately loads from the theme. Although you could edit those files directly, they would be overwritten the next time the build process runs, and are not tracked (by default, at least) in git.

If you’re curious why the Roots stack is built the way it is, I recommend reading our essay on the 12-factor App philosophy, and why we build Roots to apply that philosophy to the WordPress ecosystem: https://roots.io/twelve-factor-wordpress/

The “time cost” of setting up a local dev environment for Sage may be higher than you’re used to, but generally you should only need to set it up once; after that you’re ready to go. Sage provides a lot of benefits mechanically, but I’ve also found that it’s helped teach me to become a better developer.

1 Like

Thanks a lot! I see the difference, this system is great, I have built one theme with it and development process took less time and was much easier (excluding time for learning it).
Now, when I’m making small changes, I have to test it locally, send to github and upload to Wordpress. Probably, it’s good to have a staging env for website + auto deployment from git.
Still a lot to learn.

This topic was automatically closed after 42 days. New replies are no longer allowed.