<p>In <a href="https://github.com/openstreetmap/openstreetmap-website/blob/53cc1d2d11d358c171ee5beab55a3d20b79e9dab/app/assets/javascripts/osm.js.erb">app/assets/javascripts/osm.js.erb</a> we need to tell sprockets to recompile the output whenever the settings change. To do this we mark that file as depending on <code>config/settings.yml</code> and <code>config/settings.local.yml</code>.</p>
<p>However, this throws up two problems:</p>
<ul>
<li><code>settings.local.yml</code> is supposed to be optional, but Sprockets throws an error if the file can't be found.</li>
<li>The config gem also supports a <a href="https://github.com/railsconfig/config/blob/3a28b646a69c16f87d6539b4e1c4189aecb34c84/lib/config.rb#L60-L70">bunch of other files</a>, which should also trigger a recompile if they exist and then get changed.</li>
</ul>
<p>I've checked through the sprockets documentation, but I can't see any obvious guidance for approaches to this situation.</p>
<p>Potential solutions include:</p>
<ul>
<li>Remove the dependency on <code>settings.local.yml</code>. 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).</li>
<li>Ask the upstream sprockets developers what they think about depending on optional files, or if they have any suggestions.</li>
<li>Create an initializer which outputs the computed settings to a file, and depend on that output file instead.</li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/issues/2185">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABWnLdB6ezjGN9MC5FooswghUc5132cXks5vYhNigaJpZM4b_A1m">mute the thread</a>.<img src="https://github.com/notifications/beacon/ABWnLQ6xSR0zwc9PD3S2rcqa7qQnVgR5ks5vYhNigaJpZM4b_A1m.gif" height="1" width="1" alt="" /></p>
<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/openstreetmap/openstreetmap-website","title":"openstreetmap/openstreetmap-website","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/openstreetmap/openstreetmap-website"}},"updates":{"snippets":[{"icon":"DESCRIPTION","message":"Sprockets vs optional config files (#2185)"}],"action":{"name":"View Issue","url":"https://github.com/openstreetmap/openstreetmap-website/issues/2185"}}}</script>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/issues/2185",
"url": "https://github.com/openstreetmap/openstreetmap-website/issues/2185",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>