Reputation: 543
As i am new to backbonejs and underscorejs, I want to know core meaning of those.
As my understanding underscorejs is just like as jQuery library, we are using those functions in backbonejs.
We can't develop backbonejs applications without underscorejs.
Am i right? If my understanding is wrong please clear on this with simple words/examples.
Thanks in advance.
Upvotes: 7
Views: 5141
Reputation: 2591
Yep, underscore is a hard dependency in Backbone. But there is light at the end of the tunnel if you like Backbone but not JQuery or Underscore: check out Exoskeleton (https://github.com/paulmillr/exoskeleton).
Exoskeleton will load JQuery and Underscore if it finds them but function fine without them.
Quotes from their website:
- Exoskeleton is a faster and leaner Backbone for your HTML5 apps.
- Both jQuery and Underscore are 100% optional in Exoskeleton. You can just throw them away.
- Your views will be rendered up to 5.5 times faster* when Exoskeleton is used without jQuery. They will also consume 2 times less memory.
- You can just replace Backbone with Exoskeleton and it will all work as before.
- Exoskeleton passes 100% of Backbone and Chaplin test suites with or without dependencies.
Upvotes: 1
Reputation: 90
It is not mandatory to use underscore with backbone, you can use underscore with knockout, but if you want to use backbone; backbone's only hard dependency is Underscore.js
.
Upvotes: 1
Reputation: 406
Its is true in a sense that backbone doesn't work without a helper library like underscore. But you can use lodash instead of underscore. I would prefer it over underscore since it has more features like high performance, AMD support, custom build support etc.
Upvotes: 2
Reputation: 25994
Backbone relies heavily on the Underscore library. You cannot have a Backbone application without Underscore.
Upvotes: 11
Reputation: 10727
Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects. It's the tie to go along with jQuery's tux, and Backbone.js's suspenders.
Upvotes: 3