In app/assets/javascripts/osm.js.erb we need to tell sprockets to recompile the output whenever the settings change. To do this we mark that file as depending on config/settings.yml and config/settings.local.yml.
However, this throws up two problems:
settings.local.yml is supposed to be optional, but Sprockets throws an error if the file can't be found.
- The config gem also supports a bunch of other files, which should also trigger a recompile if they exist and then get changed.
I've checked through the sprockets documentation, but I can't see any obvious guidance for approaches to this situation.
Potential solutions include:
- Remove the dependency on
settings.local.yml. This will make the 'out-of-the-box' situation better for developers, but could lead to problems later on when changes to that file are not reflected in the compiled javascript (without manual asset recompilation).
- Ask the upstream sprockets developers what they think about depending on optional files, or if they have any suggestions.
- Create an initializer which outputs the computed settings to a file, and depend on that output file instead.
In app/assets/javascripts/osm.js.erb we need to tell sprockets to recompile the output whenever the settings change. To do this we mark that file as depending on
config/settings.ymlandconfig/settings.local.yml.However, this throws up two problems:
settings.local.ymlis supposed to be optional, but Sprockets throws an error if the file can't be found.I've checked through the sprockets documentation, but I can't see any obvious guidance for approaches to this situation.
Potential solutions include:
settings.local.yml. This will make the 'out-of-the-box' situation better for developers, but could lead to problems later on when changes to that file are not reflected in the compiled javascript (without manual asset recompilation).