需要指令 - 文件网址 [英] Require directive - file url
问题描述
在Rails 3(Sprocket)中,有没有办法使用url将javascript文件加载到远程站点?例如,我希望使用 require 指令在.js文件中使用类似的内容,
In Rails 3 (Sprocket), is there a way to load a javascript file using a url to a remote site? For example, I want something similar to this in your .js file using the require directive,
//= require http://example.com/remote_file.js
推荐答案
否。
您只能要求应用程序内部或应用程序所依赖的宝石中的文件。请参见 http://guides.rubyonrails.org/asset_pipeline.html#asset-organization和 http://guides.rubyonrails.org/asset_pipeline.html #adding-assets-to-your-gems 。
You can only require files that are inside your application or in gems that your application depend on. See http://guides.rubyonrails.org/asset_pipeline.html#asset-organization and http://guides.rubyonrails.org/asset_pipeline.html#adding-assets-to-your-gems.
这篇关于需要指令 - 文件网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!