文件结构使用requirejs和骨干网络应用程序 [英] File structure for a web app using requirejs and backbone

查看:122
本文介绍了文件结构使用requirejs和骨干网络应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想定义使用requirejs和骨干网络应用程序的文件结构的最佳途径。
我有两个想法(1)(2)。结果
根据你什么是最好的或者你会怎么改变?


(1)

  |  - 供应商
     | - JS(jQuery的,下划线....)
| - 图片
| - CSS
| - 规格
| - 模板
| - JS
| | - utils的
| | - 模型
| | - 馆藏
| | - 意见
| conf.js
| app.js
| router.js
| - index.html的


(2)

  |  - 资产
       | - JS(jQuery的,下划线....)
       | - CSS
       | - 图片
| - SRC
       | - 模板
       | - JS
            | - 意见
            | - 模型
            | - 馆藏
            | - utils的
           conf.js
           app.js
           router.js
| - 规格
| - index.html的


解决方案

在事实上,以不同的方式各有优点和不同ways.The的优缺点最重要的事情是要找到组织files.The以下的合适的方式是组织该项目目前我正在做的事情。这种方式的焦点将是相同的模块相关的文件被放置在文件夹中。例如:人们模块,该模块中的所有文件都放在模块/基/人目录。更新和该模块的维护后,只需要关注的文件就行了此目录中,将不会影响该目录以外的文件,提高了可维护性。

我希望我的回答能给你一些帮助,我希望你一些宝贵的意见。

I am thinking about the best way to define a file structure for a web app using requirejs and backbone. I have two ideas (1) (2).
According to you what is the best or what would you change?


(1)

|-- vendor
     |-- js (jquery, underscore ....)
|-- images
|-- css
|-- spec
|-- templates
|-- js
|    |-- utils
|    |-- models
|    |-- collections
|    |-- views
|    conf.js
|    app.js
|    router.js
|- index.html


(2)

|-- assets
       |-- js (jquery, underscore ....)
       |-- css
       |-- images
|-- src
       |-- templates
       |-- js
            |-- views
            |-- models
            |-- collections
            |-- utils
           conf.js
           app.js
           router.js
|-- spec         
|-- index.html

解决方案

In fact, in different ways have advantages and disadvantages of different ways.The most important thing is to find a suitable way of organizing files.The following is the organization of the project I am currently doing. This way the focus will be the same module-related files are placed in a folder. For example: the people module, this module all files are placed in modules / base / people directory. After updating and maintenance of this module, only need to focus on the files in this directory on the line, will not affect files outside the directory, and improved maintainability.

I hope my answer can give you some help, I hope you some valuable advice.

这篇关于文件结构使用requirejs和骨干网络应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆