Section edits not updating (stylesheet and javascript)

AI-generated summary

Issue: Edits inside Shopify section Liquid tags {% javascript %} and {% stylesheet %} intermittently fail to appear on the site, while HTML changes do update.

Recent update: The original reporter’s issue resolved after switching the store’s active theme to a different theme and then back to the original.

Ongoing reports: Others confirm the problem persists (notably in 2022), especially when deploying via Theme Kit; changes in {% javascript %} may only reflect after republishing or saving the file multiple times.

Suspected cause: Server-side caching of the bundled scripts.js that aggregates {% javascript %} content, with cache invalidation not occurring reliably.

Workarounds:

  • Switch active theme away and back.
  • Republish the theme or save the affected file 2–3 times in the admin editor.
  • Add a new line at the bottom of the {% stylesheet %} block to trigger an update.
  • One suggestion: use and tags instead.

Definitions: {% javascript %}/{% stylesheet %} are Shopify Liquid section blocks; Theme Kit is a CLI tool for theme deployment.

Outcome: No official fix; discussion remains open with user-found workarounds.

Hello

Recently, editing on sections of a Shopify theme no longer works. The HTML part works and update well, but it is now impossible to edit the javascript and stylesheet part of a section.

In short, when I edit what is between the tags “{{javascript}}” or “{{stylesheet}}”, the changes don’t appear on the site. I have been working on this theme for several weeks, but this problem has just appeared.

It’s strange.

(I know that the “update trigger” happens when we edit the HTML… but it’s just not working right now.)

Thanks in advance for helping me.

You can try use … and … tags instead.

The problem resolved by itself…

I don’t know why. If this happens to you, try changing the active theme on your store for another theme. Then come back to your original theme you were working on. This may be the solution.

Regardless, the important thing is that it works now. Thanks for the help.

Confirmed this is still an issue in 2022. Deploying updates via themekit which include changes within a {% javascript %} tag will sometimes not appropriately reflect on the deployment target until a republish or manually saving the affected file within the admin code editor 2-3 times.

I suspect the bundled scripts.js file where all javascript tag content lives is getting server-side cached and is not invalidated as often as it should be.

+1

I often find edits in {% stylesheet %} not being registered. The hotfix for me is to add a new line at the bottom of the stylesheet every time it happens.