与 Dojo 一起工作是一种乐趣。在我的项目中,我在 vendor/assets/javascripts 中复制了 Dojo 的组件(我有文件夹 dojo、dojox 和 dijit)。在我的 appilcation.html.haml 中:
= stylesheet_link_tag "application"
= csrf_meta_tags
/ More ideas for your <head> here: h5bp.com/d/head-Tips
/
All JavaScript at the bottom, except this Modernizr build incl. Respond.js
Respond is a polyfill for min/max-width media queries. Modernizr enables HTML5 elements & feature detects;
for optimal performance, create your own custom Modernizr build: www.modernizr.com/download/
= javascript_include_tag "modernizr"
= javascript_include_tag "dojo/dojo", :'data-dojo-config' => %Q(baseUrl: '/assets/dojo/', modulePaths: {modules: '/assets/modules', widgets: '/assets/widgets', parseOnLoad: true})
%body
它工作正常,非常棒。
编辑:研究如何将 Dojo 与资产管道一起使用对我来说很有趣。我发现了一篇有趣的帖子,关于将 Dojo 的来源包含在正确的位置 - app/assets/javascript 。