npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vertebrae

v1.1.2

Published

Backbone as CommonJS modules

Downloads

4

Readme

Vertebrae

Vertebrae is Backbone splitted into CommonJS modules. This modular approach is particularly useful when building isomorphic apps, where you only need certain parts of Backbone, e.g. you want React to handle the View handling but still need Backbone's collections, models & events.

Vertebrae borrows certain stuff from Exoskeleton, e.g. utils.js, which is a collection of methods to replace underscore.

Vertebrae fully passes the Backbone test suite.

There are other Backbone related projects that are named Vertebrae, but they haven't been active in a while, so I decided to use this name as it's really descriptive (as Backbone consists of individual bones called vertebrae :)

Installation

npm install vertebrae

Optional underscore / lodash

Just like with Exoskeleton, underscore / lodash is 100% optional with Vertebrae.

Differences to Backbone

In no-underscore / lodash environment, there are no underscore-inspired Collection methods (each, pluck etc.), but there are ES5-inspired methods:

forEach, map, filter, some, every, reduce, reduceRight, indexOf, lastIndexOf

Also, no underscore-inspired Model methods at all.

Including whole Backbone (in browser environment)

Constructor accepts root scope, underscore implementation and jQuery implementation. Underscore is 100% optional but jQuery (or a suitable replacement) is needed for Backbone.ajax and Backbone.View.

var Vertebrae = require('vertebrae');
var _ = require('underscore');
var $ = require('jquery');
var Backbone = Vertebrae(window, _, $);

Root option is only required for Backbone.noConflict(), so if you don't need that, you can just do:

var Vertebrae = require('vertebrae');
var $ = require('jquery');
var Backbone = Vertebrae({}, null, $);

Individual requires

You might want to include only certain parts of Backbone in your Browserify builds, this is easy with Vertebrae.

Collection

Due to Backbone architecture, Collection needs a Sync adapter when using the standalone module. No default adapter is required to keep the build size small. Here's how you can use the provided Axios adapter, which is a great match for isomorphic applications. You also need to pass the default model as second parameter.

var ajax = require('vertebrae/adapters/axios');
var Sync = require('vertebrae/sync')({ajax: ajax});
var Model = require('vertebrae/model')({sync: Sync});
// optional, you can pass your favorite underscore implementation to include additional methods
var _ = require('lodash');
var Collection = require('vertebrae/collection')({sync: Sync, _: _}, Model);

Model

Collection notes also apply to model.

var ajax = require('vertebrae/adapters/axios');
var Sync = require('vertebrae/sync')({ajax: ajax});
// optional, you can pass your favorite underscore implementation to include additional methods
var _ = require('lodash');
var Model = require('vertebrae/model')({sync: Sync, _: _});

View

View requires jQuery.

var $ = require('jquery');
var View = require('vertebrae/view')({$: $});

Router

Router takes History instance as option:

var History = require('vertebrae/history');
var Router = require('vertebrae/router')({history: new History});

But will initialize new instance if not included:

var Router = require('vertebrae/router')();

Events

var Events = require('vertebrae/events');

Development

Builds (backbone.js, backbone.min.js) use browserify's standalone parameter, so they will generate UMD bundle.

Build:

npm run build

Build minified:

npm run build_min

Running test suite:

npm run test

License

MIT, see LICENSE for additional information.

Copyright (c) 2015 Lari Hoppula, SC5 Online