javascript - 将 Adob​​e Edge 脚本添加到 Rails Assets 管道

标签 javascript jquery ruby-on-rails asset-pipeline adobe-edge

这很可能是将具有依赖关系的外部脚本引入 Rails 的简单案例。

我试图让我的 Adob​​e Edge 生成的动画在我的 Rails 应用程序中工作,第一步是包含所有 Adob​​e Edge 生成的 js 文件,但到目前为止我只得到一堆 404我在 Application.js 文件中包含的所有 Edge 文件均未找到错误

这是我的 Application.js 文件

//= require jquery
//= require jquery_ujs
//= require underscore
//= require backbone
//= require california_internet
//= require hero_edgePreload
//= require edge_includes/edge.1.5.0.min
//= require hero_edge
//= require hero_edgeActions

这是 Edge 的 Preloader.js 试图找到一些文件的方式......

aLoader=[{load:"edge_includes/jquery-1.7.1.min.js"},{load:"edge_includes/edge.1.5.0.min.js"},{load:"hero_edge.js"},{load:"hero_edgeActions.js"}]

最佳答案

我让它工作的方法是将 hero_edgePreload.js 更改为 hero_edgePreload.js.erb

并改变:

aLoader=[
  {load:"edge_includes/jquery-1.7.1.min.js"},
  {load:"edge_includes/edge.1.5.0.min.js"},
  {load:"hero_edge.js"},
  {load:"hero_edgeActions.js"}
];

收件人:

aLoader=[
  // {load:"edge_includes/jquery-1.7.1.min.js"}, Already required in application.js
  {load:'<%= asset_path("edge.1.5.0.min.js") %>'},
  {load:'<%= asset_path("hero_edge.js") %>'},
  {load:'<%= asset_path("hero_edgeActions.js") %>'}
];

您也可以从 application.js 中的需求中删除任何 Adob​​e Edge JS 文件。

您必须将 asset_path 添加到 hero_edge.js 中的任何图像,并将其也更改为 hero_edge.js.erb

如果有更简单的方法,我很想知道:)

关于javascript - 将 Adob​​e Edge 脚本添加到 Rails Assets 管道,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16258127/

相关文章:

javascript - Facebook Connect 对话框不会自动关闭

javascript - 如何将 Intl.NumberFormat 与 native react 一起使用?

javascript - Jquery 在 html 页面上查找名称并添​​加超链接

jquery - jquery-select2 的依赖下拉内容

ruby-on-rails - 如何测试外部 API 调用,而无需将代码更改推送到 Ruby on Rails 应用程序?

javascript - 将任何出现的对象名称替换为对象值

javascript - window.location.href 在 Response.End() 之后不起作用

javascript - 带过滤器和排除功能的 jQuery 选择

javascript - 无法从 jquery ajax 向 php 发送数据?

ruby-on-rails - 无法回滚迁移