JavaScript

Bundle

The JavaScript bundle is a self-contained browserify build. That means that the script will not pollute the main namespace and should not cause problems with other scripts that are required by your app.

Usage

Patterns that use javascript can be identified by the use of class names with the .js- prefix. usually there is a root element that contains some child elements that can be interacted with:

<div class="js-accordion ...">
  <button class="js-accordion-toggle ...">
    <!-- ... -->
  </button>

  <div class="js-accordion-region">
    <!-- ... -->
  </div>
</div>

If data needs to be passed to the module data attributes are used. Be sure to take notice when creating markup that will be interactive with JavaScript.

Some complex patterns like the header also require the use of ids, beware when creating your markup.

TODO

  • [ ] Should some libraries be global, e.g. jQuery?