0

One issue I am working with is how to structure a RoR project that is also structured to create dojo AMD modules. RoR has strong file structure "requirements" and all the tutorials/documentation for dojo have their own "requirements" and the two don't seem to mesh.

Has anyone built a project to accomplish this and just how did you manage the directory structures. A clear point of concern is how the dojo modules and widgets live in the asset pipeline during development. I don't want to develop the dojo modules in one project then move to a different project to use those modules. Much more efficient to be able to develop the RoR project and the dojo together.

I am currently using the dojo-rails gem but I am not committed to it by any means.

Thank you

1 Answer 1

0

Working with Dojo is pleasure . In my project , I've copied Dojo's components in vendor/assets/javascripts (I have folders dojo , dojox and dijit ) . In my 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

It works fine and it's fantastic .

EDIT : It was interesting for me to research how to use Dojo with assets pipeline . I've found an interesting post about including the source of Dojo in the right place - app/assets/javascript .

2
  • I understand that you are basically bypassing the asset pipeline which I get. My real concern is in dojo development beyond using the base dojo classes. In the tutorials (dojotoolkit.org/documentation/tutorials/1.8/modules) for developing modules they recommend a structure of: / index.html js/ lib/ dojo/ dijit/ dojox/ my/ util/ So how to fit this into the RoR directory structure and have both environments play nice. Dec 5, 2012 at 1:29
  • You are absolutely right , I'm using base Dojo classes . I'd love to see the right solution .
    – R Milushev
    Dec 5, 2012 at 1:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.