Working on a client's site built with Sage by another dev

Hi @spsrohan,

Welcome! I’ll try to shed some light on some of your questions, but the ‘Sage 9 beginners questions’ response is still great advice in general. It’s worth tracking changes with GIT and getting the build system set up properly.

Can I add templates to resources/views/** without breaking the build?

Adding *.blade.php files to resources/views won’t break the build process or be overwritten. Blade templates are compiled + cached or retrieved at runtime.

Adding styles or JS to this folder isn’t a good idea though. They won’t be overwritten, but this does break convention, and is the start of a slippery slope towards an unmaintainable mess.

I am not using Laravel or Blade templates as part of this project. Is that a problem?

No problem at all. You can opt in / out of Blade as required. *.blade.php files can be used with plain PHP code.

How would I find the version of Sage being used?

CHANGELOG.md could hint at the version used to seed the project. You could also check composer.json. If composer.json refers to roots/sage-lib as a dependency, you’re running Sage 9.x. If not, it’s likely Sage 10.x.

Is everything listed in package.json required for the testing/build?

Probably, yes.

Generally speaking, running composer install and yarn or npm install should set you up with everything required.

Is using Vite with Sage officially supported?

As far as I know, no. It’s quite possible that your project was started with something like GitHub - 8bit-echo/sage-vite: A WordPress theme based on sage with Vite tooling and HMR Support .

If it looks like it is, I’d highly recommend skimming over that readme, and make use of the build system.

Setting up a compatible dev environment isn’t usually that complex, and most of the tooling is easily installed. If you’re working on a dev server already, you might find all it takes to fire up a great developer experience is to run yarn dev or equivalent.

I might be overstepping the mark here, but I can’t stress enough how beneficial being confident with composer and npm is. You don’t need to learn them in depth, just know enough to operate them.

I hope that’s useful, and apologies if some of it is vague. It’s hard to know exactly what you’re working with.

2 Likes