The Frontend Application Skeleton

The pages are being serviced by an application JavaScript file that calls for help in a modular way.

Example 43.4. The Code Referenced by layout.pug, javascripts/site.js
'use strict';

import {$} from './modules/nQuery.js';
// more imports

const doSomething = function () {
    // to do
}

const init = function () {
    if ($('putItHere')) {   // on the right page
        doSomething();
    }
};

window.addEventListener('load', init);