Running gulp --production locally

So far we’ve decided not to run node or gulp on our production server. That will probably change but in the mean time, we’ll just deal with committing compiled code to the repo. :scream:
So I’ve removed dist from .gitignore, ran gulp --production, committed and deployed.
I’ve verified that /dist/assets.json is listing the production file names and that they exist. But for some reason the production server is insisting on requesting main.css and main.js.

Can anyone tell me how to fix that?

Not sure what to tell you. If dist/assets.json exists, that should be used: https://github.com/roots/sage/blob/master/lib/assets.php#L48-L51

Since we have no idea how your server is set up, are you sure there’s no type of PHP or page caching going on?

Also, older versions of the theme relied on WP_ENV to be set to production

We use git for version control as well. We also have our dev server as well as production servers. The way we run things is to branch off the master for development. This deploys to dev upon any new commits. When we have production ready code, we merge and then deploy to production. Couple things:

  1. We always call all assets from the /dist folder so never a need for it to be in the .gitignore file.
  2. There is no need for Node or Gulp to be run on either server, on in the dev environment.
  3. The only change we make from dev to production is to comment out the WP_ENV constant from development.

If you put a link to your site we might be able to get a better idea of what is going wrong with your build.

@kalenjohnson Possibly. Going to ask our admin if anything like that might cause this.
@ben Yep tried that. I’m building on top of 8.4.0 so not sure if that’s a thing anymore. I’m not using bedrock or trellis.
@vandigroup That was exactly my process on my last Roots site. Commit hooks made that a really nice way to deploy. I’d rather head towards a more CI solution in the near future. This is a private server during dev so I can’t share the link but thanks for the offer.

Thanks for the input guys.

Turns out it was a file ownership issue. Since I just removed /dist from the ignore file it was new to the server and had default ownership. :dizzy_face:

Thanks again for the awesome theme.

2 Likes

Awesome, thanks for following up!