Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>You want a non fingerprinted asset url for third party websites.</strong> For example: assets/public_api.js</p> <p>There have been plugins or gems that excluded specified assets from fingerprinting. However rails has changed the pre-compilation process in a way that also creates non-fingerprinted files. Therefore this isn't a problem. More info <a href="https://github.com/rails/rails/pull/3161" rel="nofollow">here.</a></p> <p><strong>How to make sure your clients are loading the latest deployed script, when the asset is not fingerprinted?</strong></p> <p>I would suggest the solution <a href="https://developers.google.com/youtube/iframe_api_reference" rel="nofollow">youTube uses to expose their API</a>. Basically all your assets/public_api.js does, it injects another script tag into the dom. That injected one loads the actual API code. Now your assets/public_api.js becomes assets/public_api.js.erb and looks something like this:</p> <pre><code>var tag = document.createElement('script'); tag.src = "&lt;%=asset_path('/assets/javascripts/acctual_api')%&gt;"; var firstScriptTag = document.getElementsByTagName('script')[0]; firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); </code></pre> <p>Please note how <strong>tag.src</strong> is set to the <strong>current fingerprinted path</strong> to /assets/javascripts/acctual_api. This way your users will always get the latest compiled acctual_api script.</p> <p><strong>How to update the ETAG for the assets/public_api.js?</strong></p> <p>I suppose you use Capistrano or similar recipe based deployment solution. Maybe you could add a deployment step that updates the server config file before its restarted. It should just update:</p> <pre><code>add_header Etag="update_me_on_deploy" </code></pre> <p>Please note that you should still use versioned (assets/public_api.0.js) public scripts even with this approach.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload