1

I've got a Rails app which uses the twitter-bootstrap-rails gem to provide Bootstrap resources. I was having a difficult time trying to add jquery ui, but that's not my question. When trying to get jquery ui working, I added and removed numerous gems and updated files driving the asset pipeline.

Now it seems I have damaged the Rails/Bootstrap javascripts, as a nav bar drop down no longer works.

The app is not that far along, and I can restart the build to resolve the issue. But I am trying work out where I should look when there are problems in the asset pipeline, for future reference.

I have checked the following places, and they all look ok:

  • Gemfile
  • application.js
  • bootstrap.js.coffee
  • application.css
  • bootstrap_and_overrides.css.ls
  • application.html.erb

I have also tried the following commands:

$ rake assets:precompile
$ rake assets:clean

And of course I have tried bouncing the web server and clearing the browser cache. The application is on dev only.

When there is a asset problem or conflict, what is the best way to troubleshoot it? Should I be using Firebug or the like to help identify the actual issue?

4

1 回答 1

2

尽管这是一个广泛的问题,并且与资产相关的项目的错误可能来自各种来源,但您的第一道攻击线应该是 Firebug 或 Chrome 开发工具,因为它们可用于准确检查已加载的资产以及是否存在任何问题跟他们。无论导致什么错误,您目前都遇到了资产本身的问题,因此首先应该检查它们。

这方面的一些更具体的项目将查看是否存在任何 Javascript 错误(使用开发工具控制台选项卡),以及查看已加载的资产(使用开发工具网络选项卡)。一旦您可以确定您的资产有什么问题,您就可以向后移动一步以查看您的资产未加载或加载不正确的原因。

于 2013-06-03T18:52:55.450 回答