Skip to content

Instantly share code, notes, and snippets.

@caridy
Created November 14, 2012 05:47
Show Gist options
  • Save caridy/4070536 to your computer and use it in GitHub Desktop.
Save caridy/4070536 to your computer and use it in GitHub Desktop.
[
{
"settings": [ "master" ],
"appPort": 80,
"staticHandling": {
"cache": true
},
"yui": {
"config": {
"combine": true,
"maxURLLength": 500,
"fetchCSS": false
}
}
},
{
"settings": [ "environment:dev" ],
"appPort": 8666,
"yui": {
"config": {
"combine": false
}
}
}
]
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']});
[
{
"settings": [ "master" ],
"yui": {
"config": {
"seed": [
"yui-base",
"loader-base",
"loader-yui3",
"loader-app",
"loader-app-base{langPath}"
]
}
}
}
]
[
{
"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"
]
}
}
}
]
#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/
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