split
split copied to clipboard
Assets for dashboard are not compatible with Asset Pipeline
When deploying to a production environment, the /split
assets are not made available on the expected path. For example, /split/reset.css
is a 404.
This seems to be because the engine does not use the recommended way of referring to assets for engines. Specifically, this section:
You can define assets for precompilation in
engine.rb
:initializer "blorgh.assets.precompile" do |app| app.config.assets.precompile += %w( admin.js admin.css ) end
Instead of using the asset pipeline helpers like stylesheet_link_tag
and javasript_include_tag
in the Application Layout, the code is using a url
method from the helpers. This is less compatible with some deploy environments than the asset pipeline.
A workaround is to extract the js and css assets from the gem and copy them into your host application under public/split
. By doing so, the deployed split dashboard code will be able to find http://domain.com/split/reset.css
, for example. I've implemented this workaround in my codebase and it does the trick.
I may open a PR in the near future to fix this up, but in the meantime I wanted to share this information with the community in case others struggle with this.
@iwz thanks for looking into this, a pull request to improve this would be 👌 when you have time.
+1