JavaScript and CSS framework for building richly interactive web applications ◦ http://developer.yahoo.com/yui/ ◦ https://github.com/yui § YUI3 is a foundation for Cocktails 6
on YUI 3. One Language ◦ Mojito allows developers to write client and server components in the same language - JavaScript, using the same framework. Two Runtimes ◦ Mojito can run on the client (in the browser) and on the server (with Node.js). In addition, Mojito has built-in support for internationalization and testing 9
Get mojito from npm registry ◦ npm install mojito -g Create a mojito application ◦ mojito create app helloworld Create a mojit in application ◦ mojito create mojit myMojit Modify the controller.server.js ◦ vi mojits/myMojit/controller.server.js Run the mojito application ◦ mojito start Go to http://localhost:8666/@myMojit/index 22
can include template tags, such as Mustache tags, and are located in the views directory We call these files view templates Naming Convention for view templates ◦ {controller_function}.[{device}].{rendering_engine}.html Example ◦ greeting.mu.html - This view template gets data from the greeting function of the controller and the calling device is determined to be a Web browser. ◦ get_photos.iphone.mu.html - This view template gets data from the get_photos function of the controller and the calling device is an iPhone. ◦ find_friend.android.mu.html - This view template gets data from the find_friend function of the controller and the calling device is Android based. 27
cp index.mu.html index.iphone.mu.html ◦ vi mojits/myMojit/views/index.iphone.mu.html Run the mojito application ◦ mojito start Go to http://localhost:8666/index 29
that make developing applications easier. HTMLFrameMojit ◦ The HTMLFrameMojit builds the HTML skeleton of a Web page. LazyLoadMojit ◦ This allows Mojito application to load the page quickly and then lazily load parts of the page. http://developer.yahoo.com/cocktails/mojito/ docs/topics/mojito_framework_mojits.html 31
CSS3, YUI and relative technology Mojito is a MVC application framework ◦ One language ◦ Two Runtimes Mojito is available under a BSD license A lot of docs are available, we can start from http://developer.yahoo.com/cocktails/mojito/ We also have forum to discuss this: http://developer.yahoo.com/forum/Yahoo-Mojito 36