Skip to content

Commit

Permalink
Normalize requirejs/require calls
Browse files Browse the repository at this point in the history
  • Loading branch information
evverx committed May 11, 2015
1 parent fc00dfb commit 977140e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ As you do builds and see in the build output that each page is including the
same module, add it to common's "include" array in **tools/build.js**.

It is better to add these common modules to the **tools/build.js** config
instead of doing a require([]) call for them in **js/common.js**. Modules that
instead of doing a requirejs([]) call for them in **js/common.js**. Modules that
are not explicitly required at runtime are not executed when added to common.js
via the include build option. So by using **tools/build.js**, you can include
common modules that may be in 2-3 pages but not all pages. For pages that do
not need a particular common module, it will not be executed. If you put in a
require() call for it in **js/common.js**, then it will always be executed.
requirejs() call for it in **js/common.js**, then it will always be executed.

## More info

Expand Down
2 changes: 1 addition & 1 deletion tools/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
//listed before the build layer that wants to exclude it.
//"include" the appropriate "app/main*" module since by default
//it will not get added to the build since it is loaded by a nested
//require in the page*.js files.
//requirejs in the page*.js files.
{
//module names are relative to baseUrl/paths config
name: '../page1',
Expand Down
4 changes: 2 additions & 2 deletions www/js/page1.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//Load common code that includes config, then load the app logic for this page.
require(['./common'], function (common) {
require(['app/main1']);
requirejs(['./common'], function (common) {
requirejs(['app/main1']);
});
4 changes: 2 additions & 2 deletions www/js/page2.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//Load common code that includes config, then load the app logic for this page.
require(['./common'], function (common) {
require(['app/main2']);
requirejs(['./common'], function (common) {
requirejs(['app/main2']);
});

0 comments on commit 977140e

Please sign in to comment.