Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

That's just the tip of the iceberg. Many complicated projects have landing page which should not include the whole javascript app, but still need the same collections & models. Or for example website with CMS will include administration part which is fairly different in structure.

My applications are backbone based and my directory structure is similar to :

   scripts/
     classes/
       collections/
         socket.coffee
       ui/
         popup.coffee
       page.coffee
     models/
       user.coffee
     collections/
       items.coffee
       products.coffee
     ui/
       navigation/
         top.coffee
         sidebar.coffee
       overlay.coffee
     pages/
       landing/
         home.coffee
         about.coffee
       cms/
         home.coffee
         admin.coffee
     utils/
       templates.coffee
     landing.coffee
     cms.coffe
What's important in my app is classes path. I put there only reusable classes, and using coffeescript I can simply extend the whole module by

   class Items extend require('classes/collections/socket.coffee')

   module.exports = new Items()
Also I always use utils folder, for general javascript helper functions.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: