This guide introduces the most important aspects of JavaScriptMVC (JMVC) by creating a simple cookbook application. There's also a Rapid Start if you want a few quick how-tos. Or for an in depth example, read Organizing a jQuery Application.
Watch
2.0 Video
Check out the
JavaScriptMVC 2.0 video that walks you through much of the getting started guide.
It's an older treatment, but still touches on JMVC's strong points.
Before jumping in, there are some things you should know:
JavaScriptMVC is for client side JavaScript development. JavaScriptMVC is our way of making quality, maintainable applications in the shortest amount of time.
JMVC logically separates a basic app into following folder structure:
appname - your app files
\controllers - organized event handlers
\models - manage data
\resources - helper scripts
\test - test files
\funcunit - funcunit tests
\qunit - qunit tests
\views - html templates
documentjs - documentation engine
funcunit - testing tool
jquery - jquery and jQuery plugins (like $.Controller)
steal - compression and build
JavaScriptMVC is comprised of 4 sub projects:
Everything is a plugin. Just steal the ones you need. Plugins load their own dependencies and won't load duplicate files. It looks like:
steal.plugins('jquery/model',
'jquery/view',
'jquery/controller');
steal.plugins('a/b') adds a/b/b.js
to your project. JavaScriptMVC is MIT with the following exceptions:
These exceptions, although permissive licenses themselves, are not linked in your final production build.
Lets get started by installing JavaScriptMVC.