Rails 4: Where to put JavaScript/CSS plugins

前端 未结 3 599
执念已碎
执念已碎 2021-01-20 03:40

I have Rails 4rc1 application. I need to integrate some JavaScript / CSS plugins / 3rd party libraries/ to my application. I know vendor/plugins directories are deprecated i

3条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-20 03:57

    Rails 4.0 no longer supports loading plugins from vendor/plugins. You must replace any plugins by extracting them to gems and adding them to your Gemfile. If you choose not to make them gems, you can move them into, say, lib/my_plugin/* and add an appropriate initializer in config/initializers/my_plugin.rb.

    http://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.html#upgrading-from-rails-3-2-to-rails-4-0-vendor-plugins

    You could of course move the javascript libraries to anywhere in your app/assets/ folder.

提交回复
热议问题