需要指令 - 文件网址 [英] Require directive - file url

查看:89
本文介绍了需要指令 - 文件网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在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屋!

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