// initialize the application
var app = Sammy('#main', function() {
// include a plugin
this.use('Mustache');
// define a 'route'
this.get('#/', function() {
// load some data
this.load('posts.json')
// render a template
.renderEach('post.mustache')
// swap the DOM with the new content
.swap();
});
});
// start the application
app.run('#/');
RESTful Evented JavaScript
-
SMALL
Sammy's core is only 16K compressed and 5.2K compressed and gzipped
-
MODULAR
Sammy is built on a system of plugins and adapters . Only include the code you need. It's also easy to extract your own code into reusable plugins.
-
CLEAN
The entire API was designed to be easy to understand and read. Sammy tries to encourage good encapsulation and application design.
-
FUN
What's the real point of development if its not enjoyable. Sammy tries to follow the MATZ approach. It is optimized for developer happiness.