在Rails 3(Sprocket)中,有没有办法使用url将javascript文件加载到远程站点?例如,我希望使用 require 指令在.js文件中使用类似的内容,
//= require http://example.com/remote_file.js
答案 0 :(得分:8)
没有
您只能要求应用程序内部或应用程序所依赖的gem中的文件。请参阅http://guides.rubyonrails.org/asset_pipeline.html#asset-organization和http://guides.rubyonrails.org/asset_pipeline.html#adding-assets-to-your-gems。