Developing a dojo module. Best practice ?

Kal Ahmed
Member since: 2009
 

I'm trying to figure out the best way to develop and debug a dojo-based module for CMS 7.  Ideally I would like to have a short build/debug cycle that makes it easy to do debugging of both server and client-side code. At the moment, the best approach I can see is to create a site and develop the code as part of the default module (editing the module.config in the site root) - which avoids the NuGet packaging step. I can see this getting me far enough down the road to having some running code, which is nice.

However, once I want to package my module up properly so that it can be distributed I'm going to either have to extract the module content and configuration in some automated manner to generate the NuGet package or switch to a project more like the sample module project from EPiServer. The problem with having the module built as a separate project that generates a NuGet package is that my simple build/debug cycle then becomes a more lengthy build/package/deploy/debug cycle, which I would like to avoid if possible.

So, has anyone had any experience (good or bad) of this process that they could share ? Any tips on the best way to get a nice development environment setup for ongoing development / maintenance of a module ?

 

#66103 Feb 20, 2013 11:11
  • Dmytro Duk
    Member since: 2008
     

    I would suggest to keep your module in separate project.

    Add virtual path provider on your site that is mapped to module project directory where you have all resources and module.config.

    Register your module as public or protected in episerver.shell section to make sure that module is initialized properly.

    Add after-build events in your module project to copy assemblies in site bin folder (or modulesbin folder if your module is going to be released as an add-on).

    #66106 Feb 20, 2013 12:36
  • Sergii Vorushylo
    Member since: 2008
     

    Hello Kal,

    If you are going to distribute your module as an Add-On then you might find some tips in this blog post. The same approach can be used for any module development. In short - create a site and add sites project to the solution. Then add another project for your module, but place it in a folder under the site root so that page templates and client files will appear in the same place where you expect them after the module being installed. The only thing to customize then is the location where modules binaries should be placed.

     

    #66107 Feb 20, 2013 12:45
  • Kal Ahmed
    Member since: 2009
     

    Thanks both of you for those helpful tips - I'm going to try out both approaches and see which works best for me. I'll report back later!

    #66138 Feb 21, 2013 9:18