开发者

Including external libraries using the Rails 3.1 asset pipeline

开发者 https://www.devze.com 2023-03-31 19:20 出处:网络
Background: I wish to use freebase suggest in my app. I intend to add an autocomplete to the #location input using coffeescript:

Background: I wish to use freebase suggest in my app.

I intend to add an autocomplete to the #location input using coffeescript:

$ ->
  $("#location").suggest type: "location"

Which will be included by the asset pipeline at require_tree in my application.js file:

//= require jquery
//= require jquery_ujs
//= require modernizr
//= require_tree .

Must I copy suggest.min.js to app/assets/javascripts and require it as

//= require suggest.min

or can I require it 开发者_如何转开发directly from its publicly available url?


You can always get it from the CDN by putting it in a view or template.

<%= javascript_include_tag "http://freebaselibs.com/static/suggest/1.3/suggest.min.js" %>
0

精彩评论

暂无评论...
验证码 换一张
取 消