Require directive - file url

旧城冷巷雨未停 提交于 2019-12-23 13:16:00

问题


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

回答1:


No.

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.



来源:https://stackoverflow.com/questions/14544825/require-directive-file-url

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!