title: Rails - Render asset javascript
body: <p>Is there any chance to render a precompiled javascript file? The plain file is no problem with:</p>
  
  <pre><code>def iframe_communication
    render file: "/app/assets/javascripts/iframe_communication_module.js"
  end
  </code></pre>
  
  <p>I tried <code>assets_path</code> or to include it with <code>javascript_include_tag</code> in the view, but no succeeds.</p>
  
  <p>For clarification I don't want to add the script to my view. I try to render the javascript file for external access (adding into <code>&lt;script&gt;</code> tags from other domains).</p>
  
  <p><strong>Update</strong>  </p>
  
  <ul>
  <li><code>render file: "..."</code> shows the file as expected but the uncompiled version  </li>
  <li><code>assets_path "/app/assets/javascripts/iframe_communication_module.js"</code> returns <code>"/app/assets/javascripts/iframe_communication_module.js"</code> and not a path to the compiled asset</li>
  <li><code>javascript_include_tag</code> loads the script as expected (Not Rendering)</li>
  </ul>
  
  <p>The Rails 4 asset pipeline compiles everything into one file, is there any chance to get a single file out of it?<br>
  Or is the better way to compile it manually?  </p>
  
  <p><strong>Update 2</strong><br>
  Found <a href="https://stackoverflow.com/questions/18415934/sprockets-asset-path-is-not-returning-the-digested-path-of-an-html-asset-in-pro">this</a>: <code>assets_path</code> don't do what I expected. It only prepends and appends:  </p>
  
  <pre><code>asset_path "application.js" # =&gt; /application.js  
  asset_path "application", type: :javascript # =&gt; /javascripts/application.js
  </code></pre>