That sounds like an XY issue.
Principle 1: A string must be deterministic and configuration independent for the environment.
Principle 2: Compiling static assets should be part of the assembly.
You must move on to purely static assets. You can use ERB, but just to call methods like asset_path , which are deterministic and that give the same result with the same code base. You can put data or behavior based on the configuration there, but only if the data or behavior is the same in all deployments (dev, test, staging, qa, pre-prod and prod).
Everything that comes from the configuration for each environment should not be part of static assets. Instead, you can deliver this in HTTP headers, attributes of the <html> element, or other injection methods. The static asset code must be smart enough to search for the entered data in the HTTP headers or <html> attributes and change its behavior based on the data that was entered.
Regarding the bonus question, config.cache_store not a configuration control for stars, sasses, compasses, etc.
source share