Stop File Versioning after gulp --production

So, I’m new to Roots. I’ve made lots of Wordpress sites in the past, and with an important site that I’m building, I decided to use Roots.

The current thing that I’m banging my head against the wall with is why my main.css file is getting versioned. I ran “gulp --production” for some reason, and my main.css file became something like main-cb9cfe3715.css. However, now, when I run gulp, it is not changing the file back to main.css.

I am working on a site that is in a shared development environment, so that other people can get in and post content into WordPress, but I’m the one doing the development work on the actual files. To do this, I have a local install, but I’m FTP-ing the changed files to the development server. Everything was working fine, and “gulp watch” was chugging along, compiling to main.css every time I saved something… until I ran that “gulp --production” command. Now, the development site’s .css file has become versioned, and I can’t seem to get it to go back to looking for “main.css”, which requires me to manually run “gulp --production” each time I make an update to the files. Is there a way for me to “undo” that gulp --production command? I’m sure this boils down to me not understanding my development and production environments, I just can’t figure out how to fix it.

The files are versioned for cache busting purposes and to remove sourcemaps.

See more here: Scss files don't seem to be building correctly

Ok, thanks for the link. My problem was that when you run “gulp”, it deletes and replaces the dist folder. However, when I FTP the changed files to the development server, it is only uploading the changed files. Running “gulp --production” generates an “assets.json” file in the dist folder, which apparently defines the new versions of the files. That file does not get generated when you run “gulp”. Because it is not changing, my FTP program is not flagging it to be uploaded and nothing is telling the development server to remove that assets.json file. The fix is to manually delete the “dist” folder from the development server, then allow it to be recreated when you re-upload the new version after running “gulp”. It all makes sense now, and probably seems super-obvious to most people, but it wasn’t making sense to me. Hopefully this will help others coming behind me.

The fix is to manually delete…

Actually the fix is to stop using FTP immediately. Using a modern theme development workflow along with such an anachronistic (i.e., no) version control system is not recommended and it’s not how Sage is intended to be implemented or maintained.

1 Like