Friday, April 20, 2012

javascript - Twitter bootstrap jquery plugins compiled for production but not understood by the browser

I'm developing a 3.1 Rails app with Twitter Bootstrap using seyhunak's gem.



On the production mode, I was able to use basic bootstrap CSS and JS through pipeline precompilation:



RAILS_ENV=production bundle exec rake assets:precompile


Using the gem file :



group :assets do
gem 'sass-rails', '~> 3.1.5'
gem 'coffee-rails', '~> 3.1.1'
gem 'uglifier', '>= 1.0.3'
gem "twitter-bootstrap-rails"
end


And the application.js file:



//= require_tree .

//= require jquery
//= require jquery_ujs
//= require twitter/bootstrap
//= require bootstrap-tab
//= require bootstrap-modal
//= require bootstrap-dropdown
//= require bootstrap-popover


The application worked fine except for for the bootstrap plugins such as modals and dropdowns. These plugins exist as static javascript libraries existing inside the vendor assets directory:



/vendor/assets/javascripts/bootstrap-dropdown.js
...


It seems to me that these files are not being precompiled, how can I manage to do so?



Update:



I opened the precompiled application.js and found that the plugins code do exist within it! I still have no idea why the browser is not able to load them properly.





No comments:

Post a Comment