Question re updating production styles.css file name

Hi guys, am only an occasional user of Gulp and the roots theme building environment. I have a question regarding what to upload to get style references updated when using “gulp --production” command.

So here’s the scenario. I’d built a theme based on roots a year or so ago and then had to do some debugging to fix some media queries. So after making changes I’ve done a “gulp --production” build and this has updated the main css file…

It was “main-8782c9d471.css” now it’s “main-d6cdf63c9d.css”. While I understand where this is specified in dist/assets.json but I think it’s probably better to let it get updated to ensure changes aren’t cached.

So… My question is, (aside from the main-d6cdf63c9d.css file) which files do I need to upload to ensure that this new stylesheet gets used?

You have to re-upload the entire dist folder and all of its content :smile:

2 Likes

Just to expand on that a little (I had trouble figuring this process out when I started using roots), Sage is using Assets\asset_path() to look at dist/assets.json and determine where your CSS file (and indeed, all your assets) are located. asset_path() is here: https://github.com/roots/sage/blob/8.5.3/lib/assets.php Since the file hashes change when you run gulp --production, you have to upload the whole dist folder like @Nicolo_Sacchi said–but that’s all you have to do.

4 Likes

Thanks for explaining that! Appreciate both your responses. :slight_smile: