为我的使用Jammit的sinatra应用程序获取了一个assets.yml文件。
下面是一个我想完成但做不到的事情的例子。
application: &application
- app/assets/js/vendor/jquery-2.1.1.js
- app/assets/js/vendor/underscore.js
- app/assets/js/underscore.strings.js
other_app:
- <<: *application
- app/assets/js/underscore.strings.js
- app/assets/js/vendor/angularjs/angular.js
- app/assets/js/vendor/angularjs/angular-sanitize.js
- app/assets/js/vendor/angular_plugins/**/*.js
这是我得到的错误
no implicit conversion of Hash into String
在我的布局中包含其他包很容易,但这意味着越来越多的请求,我不能那么容易地暗示所需的资产订单。(例如,此包之前需要角度包含)。
整整半天的谷歌搜索一无所获!谢谢SO!
我猜它只是缩进问题,没有其他问题。您可以在验证您的.yml内容
http://yaml-online-parser.appspot.com/
尝试它,清楚地表明它无法正确解析它。以完全相同的方式复制以下内容,它将正确开始解析:
application: &application
- app/assets/js/vendor/jquery-2.1.1.js
- app/assets/js/vendor/underscore.js
- app/assets/js/underscore.strings.js
other_app:
- <<: *application
- app/assets/js/underscore.strings.js
- app/assets/js/vendor/angularjs/angular.js
- app/assets/js/vendor/angularjs/angular-sanitize.js
- app/assets/js/vendor/angular_plugins/**/*.js
它只差1个空格。检查此链接:http://goo.gl/mUFNud
希望有帮助:)
答案如下
application: &application
- app/assets/js/vendor/jquery-2.1.1.js
- app/assets/js/vendor/underscore.js
- app/assets/js/underscore.strings.js
other_app:
- *application
- app/assets/js/underscore.strings.js
- app/assets/js/vendor/angularjs/angular.js
- app/assets/js/vendor/angularjs/angular-sanitize.js
- app/assets/js/vendor/angular_plugins/**/*.js
否<lt;:仅*应用程序