我有一个带有 Slidedeck jquery 插件的站点。当我在本地提供它时,它工作得很好,看起来很棒。但是,在我将它推送到 Heroku 之后,它根本不起作用。
我正在使用 sprockets 包含我的所有文件,并且我还使用了一个处理主题的 gem (themes_for_rails)。我在配置中有一个初始化程序:
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
这是在我的 application.js 中:
//= require jquery
//= require jquery_ujs
//= require_tree .
//= require_tree ../themes/halo/javascripts
也许我的问题是我在 Heroku 中使用相对路径。不过,我不确切知道如何做绝对路径。