Who this is for. Every developer who pushes to a Core dna theme repository. Afterwards you can recognise an unbuilt deploy in minutes rather than hours, and stop it happening again.
A theme's CSS and JavaScript are compiled from source by the theme's own build, and the compiled files are committed to the repository. The platform deploys exactly what is committed, with no build step of its own: a deploy resets the site folder to the branch as it is, so the site serves whatever compiled files were in the last commit (What is in a theme repository). Commit the build together with every source change, or the site serves files that no longer match it.
The symptom
Nothing fails. The Deployments list says success, the templates are new, and the site looks as it did yesterday, or half of it does:
- A template uses a class that the committed stylesheet does not have yet, so a new component renders unstyled.
- A template loads a new script entry that was never built, so the browser console shows a 404 for it, and nothing else does.
- A fix to a script is in the source and not in the bundle, so the live site still behaves as it did beforehand.
Because there is no error anywhere, the first hour usually goes on caches. The page cache is not the problem: a deploy clears it. Two checks tell the causes apart in a minute:
- Is the change in the committed build? Search the committed file for a string from your change (
git grepon the deployed commit). If it is not there, the build was not committed. - Is the browser holding an old copy? Theme files are sent with a one-year lifetime, so a browser keeps an old stylesheet until its URL changes. If the asset URL carries the commit hash as a version, a deploy changes it; if it does not, the browser is the stale copy (theme files).
The rule
- Every commit that changes source includes the build of that source, made with the production build command, not the development one.
- Never edit the compiled files by hand, and never append to them. The next build overwrites the edit, and the source never had it.
- One person's build should match another's. Pin the Node version and commit the lock file, so two developers building the same commit produce the same files.
A pre-push check
Catch the mistake before it leaves your machine: a git hook that runs before every push, builds, and refuses the push if the build changes the committed output.