Rails 4:在哪里放置 JavaScript/CSS 插件 [英] Rails 4: Where to put JavaScript/CSS plugins

查看:49
本文介绍了Rails 4:在哪里放置 JavaScript/CSS 插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有 Rails 4rc1 应用程序.我需要将一些 JavaScript/CSS 插件/第 3 方库/集成到我的应用程序中.我知道在 Rails 4 中不推荐使用 vendor/plugins 目录.那么我可以将 JavaScript/CSS 插件放在哪里?

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 in Rails 4. So where can I put JavaScript/CSS plugins?

推荐答案

Rails 4.0 不再支持从供应商/插件加载插件.您必须通过将它们提取到 gems 并将它们添加到您的 Gemfile 来替换任何插件.如果您选择不让它们成为 gem,您可以将它们移动到 lib/my_plugin/* 并在 config/initializers/my_plugin.rb 中添加适当的初始化程序.

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

您当然可以将 javascript 库移动到 app/assets/ 文件夹中的任何位置.

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

这篇关于Rails 4:在哪里放置 JavaScript/CSS 插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆