JavaScript

Last updated on
6 October 2020

In Drupal 8 we are going to make JavaScript rock! We want JavaScript we can all be proud of. Currently we have an 8-part plan to get there.

Clean Up The Current Code

There is room to improve our current JS:

Unit Testing

JS Unit testing via QUnit, even possibly something like jQuery Swarm.

Better Inline Documentation

Drupal is one of the best documented open source projects. Time to bring our JS up to the level of everything else.

Pluggable Preprocessing

Sometimes we write modules like Bundle Cache or we want to load scripts via scripts like labjs. Making preprocessing/aggregation pluggable means we can do some awesome stuff there.

Drupal JS Handbook Awesomeness

"JavaScript is the only language that I'm aware of that people feel they don't need to learn before they start using it." -- Douglas Crockford

Let's teach people how to do our common stuff.

JSLint/JSHint

JSLint and JSHint are great for helping us keep our JS from doing bad things. Let's use one of them in both our personal dev processes and coder module.

#1664940: [Policy, patch] Decide on JSHint configuration

Minification

Let's minify our JS. The size savings can translate into real end user performance.

Solid Architectural Patterns For All The JS

There is a LOT of JS in Drupal 7 and we imagine even more in Drupal 8. Architecturally we can benefit from using modular patterns, like what Dojo or jQuery UI are using. In addition there are some libraries, like underscore, that may be able to provide utilities that help us write better JS.

See also all core 8.0.x issues that have anything to do with javascript.

Help improve this page

Page status: No known problems

You can: