0

我已通过 rails assets 将danial-farid--angular-file-upload库添加到我的 rails 4 应用程序中。主库加载正常,但 sprockets 找不到它包含的用于文件上传进度的 shims 文件。angular-file-upload.js我认为这是因为 shims 文件与主脚本不在同一目录中。这可能是问题所在,还是我在错误的地方寻找问题?

细节:

根据github上的主页:

<!-- shim is needed to support upload progress/abort for HTML5 and non-HTML5 FormData browsers.-->

在宝石文件中:

gem 'rails-assets-danialfarid--angular-file-upload'

在 application.js 中:

//= require angular-file-upload-shim
//= require angular
//= require angular-resource
//= require angular-ui-bootstrap-tpls
//= require angular-ui-router
//= require angular-file-upload

因为这会产生Sprockets::FileNotFound错误:

couldn't find file 'angular-file-upload-shim'

如果我删除上面的第一个要求,资产管道会很好地加载其他所有内容,但它会破坏依赖 shims 文件的内容。

gems 目录的 grep 显示:

rails-assets-danialfarid--angular-file-upload-1.4.0/vendor/assets/javascripts/angular-file-upload
rails-assets-danialfarid--angular-file-upload-1.4.0/vendor/assets/javascripts/angular-file-upload/angular-file-upload-shim.js
rails-assets-danialfarid--angular-file-upload-1.4.0/vendor/assets/javascripts/angular-file-upload/FileAPI.min.js
rails-assets-danialfarid--angular-file-upload-1.4.0/vendor/assets/javascripts/angular-file-upload/angular-file-upload.js
rails-assets-danialfarid--angular-file-upload-1.4.0/vendor/assets/javascripts/angular-file-upload/angular-file-upload-html5-shim.js
rails-assets-danialfarid--angular-file-upload-1.4.0/vendor/assets/javascripts/angular-file-upload.js

我可以看到angular-file-upload.jsgem 的vendor/assets/javascripts 目录中有一个,而angular-file-upload-shim.js文件位于该文件夹的子目录中。这足以打破资产管道吗?

4

1 回答 1

2

您可能需要添加子目录。IE

//= require angular-file-upload/angular-file-upload-shim
于 2014-05-27T17:44:59.823 回答