I have a site with the Slidedeck jquery plugin on it. When I serve it locally it works just fine and looks great. After I push it to Heroku, though, it doesn’t work at all.
I’m including all my files using sprockets, and I also use a gem that takes care of themes (themes_for_rails). I have an initializer in config:
ThemesForRails.config do |config|
# themes_dir is used to allow ThemesForRails to list available themes. It is not used to resolve any paths or routes.
config.themes_dir = ":root/app/assets/themes"
# assets_dir is the path to your theme assets.
config.assets_dir = ":root/app/assets/themes/halo"
# views_dir is the path to your theme views
config.views_dir = ":root/app/views/themes/halo"
# themes_routes_dir is the asset pipeline route base.
# Because of the way the asset pipeline resolves paths, you do
# not need to include the 'themes' folder in your route dir.
#
# for example, to get application.css for the default theme,
# your URL route should be : /assets/default/stylesheets/application.css
config.themes_routes_dir = "assets"
end
This is in my application.js:
//= require jquery
//= require jquery_ujs
//= require_tree .
//= require_tree ../themes/halo/javascripts
Maybe my problem is that I am using relative paths in Heroku. I don’t know exactly how to do absolute paths, though.
I haven’t used the Slidedeck library before, but here are some things to look into to narrow down your bug source:
Javascript erroring out. Load up the console in your app on Heroku. Does basic Javascript work? If not, something could be eating your errors–I’ve seen this happen before but I haven’t been able to find what exactly causes it.
Is there actually an issue with Slidedeck loading? If it’s wrapped in a class (like how jQuery is wrapped in the jQuery class), can you reference that class in the console?
Relative paths should be fine on Heroku…but I notice in this line:
//= require_tree ../themes/halo/javascripts
you’re requiring the equivalent of
app/assets/themes/halo/javascripts. Is that right? Why not use thejavascriptsfolder? If you have css, and images in this folder as well, you can split them into their respectiveapp/assets/subfolders, just to be sure. (My teammates have told me that this isn’t or shouldn’t be necessary, but I’ve found it to help me in one or two instances).Were there any console errors pushing to Heroku related to asset precompile failure? They have a dedicated page for that error.