title: How to copy over /public folder of Rails Engine to a Rails application in production?
body: <p>I know a simple solution would be just to manually copy over all the files in the Rails Engine's /public folder to the Rails application's /public folder. However, this means that each installation would require manually copying.</p>
  
  <p>Furthermore because the Javascript files that my engine uses have hard-coded image paths, I cannot simply throw all my static files under app/assets or vendor/assets, as then Rails would copy them over to public/assets. I can't change the path where Sprockets outputs the files as I have other gems that expect their assets to be in the default public/assets folder.</p>
  
  <p>I tried doing something like</p>
  
  <pre><code>    class Engine &lt; ::Rails::Engine
          if Rails.application.config.serve_static_assets
              initializer "static assets" do |app|
                app.middleware.insert_before(::ActionDispatch::Static, ::ActionDispatch::Static, "#{root}/public")
              end
          end
      end
  </code></pre>
  
  <p>but this only works for development.</p>