Backbone.Layout
A simple layout manager for Backbone. Backbone.Layout provides easy view life cycle managment for composite views.
API
.setView(view[, selector][, options])
view
an instance of a Backbone viewselector
a css selector (optional)options
configuration options (optional)append
by default,setView
replaces viewscache
cache long-running views when replacing (do not callremove
orrender
)toggle
similar to cache, do not callremove
orrender
. Instead togglesview.$el
, preserving UI state such as the scroll bar.
This attaches a view to a selector. If no selector is provided, the view is attached to the layouts el
. Multiple views may be attached to a single element with the append
option. Long-running views may be preserved across renders and replacements with the cache
option.
Development
This project uses a gulp-based build, npm for package management, and mocha, jshint and phantomjs for testing. The development source is in backbone.layout.js
and tests are in spec/
. `To begin devleopment:
npm install
install packagesgulp
starts the develpment watchergulp test
executes the test suitegulp build
builds the production version