我已经通过rails资产将danial-farid--angular-file-upload库添加到我的rails 4应用程序中。主库加载正常,但链接器无法找到它包含的文件上载进度的填充程序文件。我认为这是因为shims文件与主angular-file-upload.js
脚本不在同一目录中。这可能是问题所在,还是我在错误的地方寻找问题?
详细说明:
根据github上的主页:
<!-- shim is needed to support upload progress/abort for HTML5 and non-HTML5 FormData browsers.-->
在gemfile中:
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
我可以看到gem的angular-file-upload.js
目录中有vendor/assets/javascripts
,而angular-file-upload-shim.js
文件位于该文件夹的子目录中。这足以打破资产管道吗?
答案 0 :(得分:2)
您可能需要在子目录中添加广告。即。
//= require angular-file-upload/angular-file-upload-shim