-
Notifications
You must be signed in to change notification settings - Fork 0
Installation
LayoutManager can be run in both browser environments and inside of Node.js environments. There is a single canonical method of installing server side with NPM, but multiple ways of loading inside of the browser.
To install in Node.js, make sure you have Node.js the version should be at least 0.6, but you should probably use 0.8 to ensure fewer potential incompatibilities.
Run the following command to install:
npm install backbone.layoutmanager
This will automatically install all dependencies into your node_modules
folder. You can then require it and use as you would inside the browser environment.
Since there is not a single agreed upon method of loading JavaScript inside of a web application, LayoutManager attempts to support as many efforts as possible without becoming a burden to maintain.
If you wish to just get LayoutManager on the page working to mess around with, you need at the minimum Backbone, Underscore, and jQuery. Your HTML should look something like this:
<!-- Dependencies. -->
<script src="jquery.js"></script>
<script src="underscore.js"></script>
<script src="backbone.js"></script>
<!-- LayoutManager. -->
<script src="backbone.layoutmanager.js"></script>
If you are more adventurous you may want to use a dependency manager like RequireJS. Getting LayoutManager to work correctly here is a breeze.
Make sure your configuration looks very similar to this:
require.config({
// This part may not be necessary depending on your setup.
paths: {
jquery: "/path/to/jquery",
backbone: "/path/to/backbone",
underscore: "/path/to/underscore",
layoutmanager: "/path/to/backbone.layoutmanager"
},
// This part is definitely necessary regardless of your setup.
shim: {
backbone: {
deps: ["jquery", "underscore"],
exports: "Backbone"
},
// Here we indicate that we need Backbone and all its dependencies,
// we also want to bind the main object.
layoutmanager: {
deps: ["backbone"],
exports: "Backbone.Layout"
}
}
});
If you are using a different AMD loader, perhaps the use.js plugin will work for you.
If you are even more adventurous you may want to try a package manager like JamJS. This is an excellent way to manage dependencies using the aforementioned Asynchronous Module Definition pattern.
To install, simply configure a JamJS environment and using the NPM tool run:
jam install backbone.layoutmanager
This will install the package and configure the dependencies for you.
If JamJS doesn't float your boat, you may want to consider Twitter's Bower package manager.
Installing is very similar to JamJS, get the Bower environment set up and then using the tool run:
bower install layoutmanager
Getting started
Usage
- Overview
- Configuration
- Basics
- Example usage
- Nested views
- Template rendering
- LayoutManager in Node.js
API reference
Migration guides
Legacy
How to contribute