Skip to content

Commit

Permalink
Added CommonJS packages to complex example page to illustrate how the…
Browse files Browse the repository at this point in the history
…se can now be loaded with RequireJS too.

Closes #70
  • Loading branch information
aquamoth committed Feb 22, 2017
1 parent 7e110a7 commit d2ac04c
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 10 deletions.
24 changes: 14 additions & 10 deletions RequireJsNet.Examples/RequireJS.complex.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
{
"paths": {
"jquery": [ "http://no-domain.unknown/jquery-2.1.3", "jquery-2.1.3" ],
"jqMin": "jquery-2.1.3.min",
"req1": "req1",
"req2": "req2",
"jquery-validate": {
"path": "jquery.validate",
"defaultBundle": "jqValidate"
},
"jquery-validate-unobtrusive": "jquery.validate.unobtrusive"
"paths": {
"jquery": [ "http://no-domain.unknown/jquery-2.1.3", "jquery-2.1.3" ],
"jqMin": "jquery-2.1.3.min",
"req1": "req1",
"req2": "req2",
"jquery-validate": {
"path": "jquery.validate",
"defaultBundle": "jqValidate"
},
"jquery-validate-unobtrusive": "jquery.validate.unobtrusive"
},
"packages": [
"cart",
{ "name": "store", "main": "store", "location": "/Scripts/CommonJS/store" }
],
"shim": {
"jquery-validate": {
"deps": [ "jquery" ],
Expand Down
3 changes: 3 additions & 0 deletions RequireJsNet.Examples/RequireJsNet.Examples.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@
<Content Include="RequireJS.complex.json" />
<Content Include="Scripts\bootstrap.js" />
<Content Include="Scripts\bootstrap.min.js" />
<Content Include="Scripts\cart\main.js" />
<Content Include="Scripts\Controllers\Foo\Home\index.js" />
<Content Include="Scripts\Controllers\Root\Home\errback.js" />
<Content Include="Scripts\Controllers\Root\Home\complexLoad.js" />
Expand Down Expand Up @@ -187,6 +188,8 @@
<Content Include="Scripts\respond.matchmedia.addListener.js" />
<Content Include="Scripts\respond.matchmedia.addListener.min.js" />
<Content Include="Scripts\respond.min.js" />
<Content Include="Scripts\CommonJS\store\store.js" />
<Content Include="Scripts\CommonJS\store\util.js" />
<Content Include="Scripts\text.js" />
<Content Include="Scripts\underscore.js" />
<Content Include="Web.config" />
Expand Down
2 changes: 2 additions & 0 deletions RequireJsNet.Examples/Scripts/CommonJS/store/store.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
//CommonJS package format
alert('store/store.js loaded');
2 changes: 2 additions & 0 deletions RequireJsNet.Examples/Scripts/CommonJS/store/util.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
//CommonJS package format
alert('store/util.js loaded');
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
define(['req1', "jquery"], function(req1, $) {
$(function () {
alert('jquery loaded');

require(["cart", "store", "store/util"], function (cart, store, util) {

alert('commonJS packages cart, store and util has been loaded');

});

});
});
2 changes: 2 additions & 0 deletions RequireJsNet.Examples/Scripts/cart/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
//CommonJS package format
alert('cart/main.js loaded');

0 comments on commit d2ac04c

Please sign in to comment.