0

Can someone give me advice on organising files in RequireJs, I am looking for the best practice way of doing it that will allow the most flexibility in the future.

my current folder structure is as below. I come from a java background that is why I have called them classes (I am aware that they are objects not classes), I am willing to change this given a better suggestion.

scripts
    > startup.js
    > class
        > FromAddress.js
        > ToAddress.js
        > ...
    > common
        > class
            > Address.js
            > UrlResolver.js
            > ...
    > lib
        >jquery.js
        >jquery-ui-core.js
        > ...
    > page
        > home.js
        > sitemap.js
        > ...

/scripts/startup.js contains the requirejs configuration script and loads the appropriate main script from the /scripts/page folder

/scripts/class contains application specific classes

/scripts/common/class contains classes that could be shared with another projects (they will eventually reside in a separate project and be injected somehow)

/scripts/lib contains javascript 3rd party libraries

/scripts/page equivalent to main.js from the documentation, basically the startup script for each page in the application.

4

1 回答 1

0

我发现http://boilerplatejs.org/非常好。

于 2013-07-11T09:44:47.373 回答