Roots Discourse

Inherited a Roots project. Need some help please!

Hello. I’ve worked on vanilla WP hundreds of times and never knew the trellis|bedrock|sage env existed until a couple weeks ago.

I took over a new project and the last dev left under not so good terms so I never got an actual handoff so I’ve had to just lurk around and figure stuff out. Obviously compared to vanilla WP, the roots,io env is a lot more complicated.

What I got was a github repo that looks like it has just the app folder, which appears to be all I need I was hoping some experts on the roots,io env could help me get up to speed.

  1. How do I know if Trellis was being used? Is it possible to just use bedrock + sage without it?
    I found this help article, but how do I know if Trellis was used? This help doc mentions an “Ansible Vault password” which I obviously don’t have and would probably have a difficult time obtaining it.
  2. How does sage compile? I tried to use follow these instructions but got nowhere.
  3. If the site has already been deployed to a live server, does that mean the last dev already installed all the compiling assets on the live server? So just updating the actual code in Git and pushing would suffice? Does a manual compile need to be done on the server with Sage?
  4. For now I just need to make a simple update. On vanilla WP it’s basically adding 3 lines of jquery|js to one of the main js files or in the footer.php file. How do I make a simple change like this in the roots,io env?

If anyone could point me in the right direction, it would be highly appreciated. Thank you!

How do I know if Trellis was being used?

Easiest way is to check for Trellis files. You can see what they are by examining the Trellis repo: https://github.com/roots/trellis/

Is it possible to just use bedrock + sage without it?

Yes. Trellis just helps you with the following tasks:

  • Provision local development virtual machine
  • Provision remote production/staging machine(s)
  • Deploy changes to remote production/staging machine(s)

If you’re doing those things in a different way, you don’t need Trellis.

How does sage compile?

The answer to this question depends a bit on the version of Sage you’re using. You might be able to determine the version from looking at the package.json in your theme directory; It may have the sage version:

{
  "name": "sage",
  "version": "9.0.9",
  "author": "Roots <team@roots.io>",
  ...
}

If it’s Sage 9+, following the instructions here: https://roots.io/sage/docs/theme-development-and-building/

It’s also helpful to us if you can expand on what you mean by “got nowhere.” Did you run into errors? If so, what errors? Where you unable to find files or directories? What files or directories?

If the site has already been deployed to a live server, does that mean the last dev already installed all the compiling assets on the live server?

Probably yes.

So just updating the actual code in Git and pushing would suffice?

Probably no, but this depends on the system that’s being used to deploy the site.

Does a manual compile need to be done on the server with Sage?

Don’t compile on the server: Compile locally (or on a CI server or something) and push to production.

How do I make a simple change like this in the roots,io env?

To change the footer, just add those lines to the appropriate template file (if this is Sage 9+, it’ll be a .blade.php file). If you add to JS, you’ll need to regenerate the JS assets. Once you’ve done either/both, you’ll deploy to your live environment.

Hey thanks so much for taking the time to reply.

  1. So if trellis was installed, I should see a /trellis folder in the same level as the public_html folder on the server? If that’s the case then it doesn’t look like trellis was used. This should be on the production server as well I’m assuming? Instead of using trellis, I could just use Xampp instead?
  2. To set up my dev theme I used composer to install a base of bedrock. Then I took what was in the git repo (mainly the /app folder) and brought it in. Then I went to the theme folder and ran the yarn command. It did a bunch of stuff but I have no idea what to do now. To get this straight, basically what you do is build in bedrock and sage locally, compile a copy of what you can upload to a server, and then just commit the compiled files to say GIT and then push compiled files to the server?)
  3. N/A
  4. OK so the process should be. 1) Edit the uncompiled sage theme locally 2) Compile the files 3) After that the compiled files are what you push as the theme to the server?

package.json says 9+
“name”: “sage”,
“version”: “9.0.7”

Thanks again for your help.

I’m just going to leave this here in case someone finds this later on and needs help getting started after they inherit a roots.io WP project and have no idea what the hell is going on.

First the dev environment is complicated to set up if you’re used to the XAMPP/MAMP + vanilla WP way to go about things. Once you get the dev environment set up though, you’ve basically won the war.

I was able to use Valet on Mac to run the local server.

There should be a repo for the code the previous dev left. I pulled that all down into a folder that Valet is watching. I went into the root directory and ran composer install

This starts building the wordpress files. Next update the .env file with the relevant database + site info. This file is unique to the dev environment. If you have staging, production, etc they will all have unique .env files.

Now go to the theme folder which should be /web/app/themes/whatever_your_theme_is

From there run composer install && yarn && yarn build - this will add in all the dependencies and compile the theme.

From there you should be able to view the functioning site. You can make changes to the theme after that in the appropriate area and then just run yarn build to compile the changes.

Then you push the code to GIT and then SSH into the server and do the yarn build again on the server.

Hopefully someone in the future can use this to figure it out what took me like 10 hours of head banging to figure out. :slight_smile:

1 Like