这很可能是将具有依赖关系的外部脚本引入 Rails 的简单案例。
我试图让我的 Adobe Edge 生成的动画在我的 Rails 应用程序中工作,第一步是包含所有 Adobe 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
中的需求中删除任何 Adobe Edge JS 文件。
您必须将 asset_path
添加到 hero_edge.js
中的任何图像,并将其也更改为 hero_edge.js.erb
。
如果有更简单的方法,我很想知道:)
关于javascript - 将 Adobe Edge 脚本添加到 Rails Assets 管道,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16258127/