Javascript Setup

The default boilerplate files comes bundled with a few libraries and patches and a basic setup to get you started right away. Light enough for projects needing basic javascript or jQuery, but easily extendible for larger sites or applications.


Folder structure

Note: Files prefixed with an underscore will be excluded from the build process.


IE files

This folder contains patches and polyfills for IE(<9), ordered in the body and head folders. Each folder will produce a concatenated file which you can use through the conditional comments in the layout templates:

By enabling the conditional comment in templates/layout/header.html:

<!--[if lt IE 9]
<script src="assets/js/ie-head.min.js"></script>
<![endif]-->

You will get:

By enabling the conditional comment in templates/layout/footer.html:

<!--[if lt IE 9]
<script src="assets/js/ie-body.min.js"></script>
<![endif]-->

You will get:


Library files

$

Headstart comes with a Jeesh build of Ender to replace the much heavier jQuery 1.11.x, which is also bundled, but excluded from the build. Feel free to revert back to jQuery if you want. Remember that you can use a fork of the boilerplate files to customize the defaults. The Jeesh comes with the following libraries and replaces almost every commonly used aspect of jQuery, but at half the weight.:

Also bundled, but excluded from the build, is an extended version of this Jeesh build, which contains extra libraries:

Note: Prefix the unused libraries with an underscore to prevent abuse of the $.

Utils

A globally-accessible wrapper for your utilities. If you have a project that uses a lot of helper functions, this file can be used to make them accessible throughout your pages. By default the class is exluded from the build. Included are functions to:

Loose libs

Dev libs

Note: Dev libraries will get excluded when building in --production.


Root files

Main script

The main.js file contains a very basic .ready() setup wrapped in an IIFE.

View specific scripts

View-specific files make it easy to include script files in individual pages. The default boilerplate contains an example file for the index page, _view-index.js. To use it, remove the leading underscore.


Next step: Back-end Integration