Created
November 14, 2012 05:47
-
-
Save caridy/4070536 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"settings": [ "master" ], | |
"appPort": 80, | |
"staticHandling": { | |
"cache": true | |
}, | |
"yui": { | |
"config": { | |
"combine": true, | |
"maxURLLength": 500, | |
"fetchCSS": false | |
} | |
} | |
}, | |
{ | |
"settings": [ "environment:dev" ], | |
"appPort": 8666, | |
"yui": { | |
"config": { | |
"combine": false | |
} | |
} | |
} | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
YUI.add('foo', function (Y, NAME) { | |
Y.namespace('mojito.controllers')[NAME] = { | |
actionName: function (ActionContext) { | |
var config = ActionContext.config, | |
mailURL = config.get('mail'), | |
yuiConfig = config.getAppConfig().yui.config; | |
} | |
}; | |
}, '0.1', {requires: ['mojito', 'mojito-config-addon']}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"settings": [ "master" ], | |
"yui": { | |
"config": { | |
"seed": [ | |
"yui-base", | |
"loader-base", | |
"loader-yui3", | |
"loader-app", | |
"loader-app-base{langPath}" | |
] | |
} | |
} | |
} | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"settings": [ "master" ], | |
"yui": { | |
"config": { | |
"seed": [ | |
"http://yui.yahooapis.com/combo?3.7.3/build/yui-base/yui-base.js&3.7.3/build/loader-base/loader-base.js&3.7.3/build/loader-yui3/loader-yui3.js", | |
"loader-app", | |
"loader-app-resolved" | |
] | |
} | |
} | |
} | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#1 create app with one mojit | |
$ mojito create app demo | |
$ cd ./demo | |
$ mojito create mojit foo | |
$ mojito start --context environment:dev | |
http://localhost:8666/@foo/index | |
#2 introduce mojito client | |
- add route to routes.json | |
"index": { | |
"path": "/", | |
"call": "frame.index" | |
} | |
- add specs to application.json | |
"frame": { | |
"type": "HTMLFrameMojit", | |
"config": { | |
"deploy": true, | |
"child": { | |
"type": "foo" | |
} | |
} | |
} | |
http://localhost:8666/ | |
#2 customize seed files on application.json | |
"yui": { | |
"config": { | |
"seed": [ | |
"yui-base", | |
"loader-base", | |
"loader-yui3", | |
"loader-app", | |
"loader-app-base" | |
] | |
} | |
} | |
#3 YUI().use() | |
- look at the source of the page / | |
#4 YUI_config | |
combine: false for offline apps | |
#5 YUI.add | |
YUI.add('yuiconf2012', function(Y, NAME) { | |
Y.conf2012 = function() { | |
Y.log('Awesome community!', 'info', NAME); | |
}; | |
}, '0.1', { requires: ['yui-base'] }); | |
#6 more custom configurations on application.json | |
- add it to master section | |
"yuiconf2012": { | |
"note": "mojito is awesome!" | |
}, | |
- add a more custom msg for device:iphone | |
{ | |
"settings": [ "device:iphone" ], | |
"yuiconf2012": { | |
"note": "mojito is even more awesome now!" | |
} | |
} | |
#7 Generating HTML5 code | |
$ mojito build html5app ./www/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var store = require("./store").createStore(); | |
var config = store.getAppConfig({ | |
environment: "dev", | |
region: "es" | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment