Used the CommonJS pattern modularise the code, and browserify to enable require statements on the front end. Built the gulp process around those concepts.