Theme release process - best practice?

I’m using roots mainly for the bootstrap CSS base. I have a roots-based theme finished on my local server and am ready to install on the client website.

I thought I could just zip up the plugin folder, but I saw I had a modules folder with 80MB+ of data in it. I tried zipping everything up and omitting that folder. When I installed the theme on the production server I got the error about assets/manifest.json missing.

I’m pretty sure I’m taking the wrong approach here. I just want to end up with a standard theme that will work on any Wordpress host. What is the normal/best process for going from local dev theme to public standard theme?

You need to use grunt build to create the minified assets and the manifest.json. Or edit the roots_scripts function to ignore the manifest file if you want to use the un-minified assets.

You are right to exclude the node_modules from the zip file though; they aren’t needed on a production server when you are compiling locally.

1 Like

Thanks Foxaii - That what helpful. I use grunt watch while in dev and I’ve got all the minified css and js, but I don’t see a manifest.json file in assets.

So , I looked at roots_scripts() and I saw some conditions based on the environment. I’m setting the environment to “development”, in wp-config, as instructed at http://roots.io/roots-101/, since I don’t use Bedrock.

If I set the environment to “development” on production, the theme works, but that feels really icky. Is that the best way forward?

No it’s not the best way forward.

As I said before, you need to run grunt build to build minified assets and the manifest.json file for use on non-development servers. There are three grunt commands in Roots; all are mentioned in the docs.

So in dev you have the environment constant, running grunt or using grunt watch. Then when you are done with the build, you run grunt build to create the files needed on staging or production.

Your other option is to edit the roots_scripts function to stop checking for the development constant, but you definitely shouldn’t set a false constant (ever).