Is there a way to disable random string for file under dist folder?

Hi All,

I’m using Sage9 Beta2.
I’m wondering if there is an easy way to disable random string on js/css/image file name. under dist folder. I want to use version number instead.
Because our site use static html file for front-end, so all css and js path are in static html. If I run yarn run build:production again, css/js file name will change, and old static html will not be able to find the new file.

Thank you for your help!

Okay, here is the solution I figure out:
Open file: /wp-content/themes/your_theme/assets/build/config.js
Edit line 25,
cacheBusting: isProduction,
cacheBusting: !isProduction,

then when run yarn run build:production, there will be no random string insert to css/js/image file name.

If you never need it, just set it to false, otherwise you’ll get versioning when building with npm run build

Thanks @Nicolo_Sacchi, your solution is better.

1 Like