Backbone.js in a Theme or Module for Drupal 8, 9, and 10

This page is archived

We're keeping this page up as a courtesy to folks who may need to refer to old instructions. We don't plan to update this page.

Alternate resources

The public Backbone and Underscore core libraries have been removed. These dependencies are now deprecated and for internal use only. Backbone.js will eventually be removed from Drupal core. Read more at drupal 10.0.0 release notes (Frontend (CSS and JavaScript) dependency changes).

It's probably not too surprising that a library called Backbone aims to provide structure to your front-end JavaScript code and applications. In this tutorial we'll take a look at how Backbone.js goes about achieving that goal, and how you can make use of it on your Drupal site. We'll first take a high-level look at the main components that make up the Backbone.js library. With that basic understanding in place we'll look at an example of how you might integrate Backbone.js into a Drupal site.

Theming Drupal Sites