Theming

Underscore.js in a Theme or Module for Drupal 8, 9

Last updated
Categories
Up-to-date with minor version
8.9.x/9.4.x

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

See the related change record for information on how to update your Underscore code with vanilla JS.

Underscore.js is a very small library which provides several utility functions and helpers to make working with JavaScript a little bit easier. In this tutorial we'll take a look at a part of the library, learn where the full library is documented, and see how we can make use of Underscore.js in a custom block on our Drupal site.