Embed Assets Theme

Oh, man :flushed_face: It was Nginx!

TL;DR:

rm -rf /var/nginx/cache/*`

Instant fix!


Optional: Disable Nginx asset caching

Edit this file:

/etc/nginx/conf.d/discourse.conf

Around lines 243-246, comment out the caching directives:

      # proxy_cache one;
      # proxy_cache_key "$scheme,$host,$request_uri";
      # proxy_cache_valid 200 301 302 7d;
      # proxy_cache_bypass $bypass_cache;

Then restart Nginx:

sv restart nginx

:artist_palette: If you’re changing color palettes…

Just editing the color settings in the theme won’t regenerate embed_[digest].css. To force Discourse to generate new asset files, do this:

rm tmp/stylesheet-cache/* # or, for embed only, `rm tmp/stylesheet-cache/embed*`

:thinking: What about RAILS_ENV=development?

You might think that setting RAILS_ENV: development would disable caching, but:

  • The nginx.sample.conf used by Discourse has caching enabled by default, regardless of environment
  • That caching is not tied to RAILS_ENV, so it won’t help with embedded asset caching

So unless you plan to fully reconfigure the Nginx layer, just clear the cache manually or disable those lines, and you’re good. Once you’re ready for production, you can revert back.

:turtle: What about ./launcher rebuild standalone?

Sure, it works. But if you’re actively tweaking themes, testing embeds, and tuning colors… you’ll want something faster than waiting a few minutes everytime.

:speech_balloon: Got a better dev setup or quick fixes? Chime in!